From b24ac75111e46949506f848edc2423ca0407c092 Mon Sep 17 00:00:00 2001 From: Rokas Kupstys Date: Sun, 4 Aug 2019 13:58:20 +0300 Subject: [PATCH 1/5] Move connection window into a popup when connected. --- server/TracyView.cpp | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/server/TracyView.cpp b/server/TracyView.cpp index 2821cb06..7ad4b900 100644 --- a/server/TracyView.cpp +++ b/server/TracyView.cpp @@ -422,11 +422,7 @@ bool View::DrawImpl() bool keepOpen = true; bool* keepOpenPtr = nullptr; (void)keepOpenPtr; - if( !m_staticView ) - { - if( !DrawConnection() ) return false; - } - else + if( m_staticView ) { keepOpenPtr = &keepOpen; } @@ -463,6 +459,14 @@ bool View::DrawImpl() #endif std::shared_lock lock( m_worker.GetDataLock() ); +#if defined TRACY_EXTENDED_FONT + const char* buttonTitle = ICON_FA_WIFI; +#else + const char* buttonTitle = "Connection"; +#endif + if ( ImGui::Button( buttonTitle ) ) + ImGui::OpenPopup( "TracyConnectionPopup" ); + ImGui::SameLine(); if( !m_worker.IsDataStatic() ) { if( m_worker.IsConnected() ) @@ -678,6 +682,19 @@ bool View::DrawImpl() DrawFrames(); DrawZones(); + + if( ImGui::BeginPopup( "TracyConnectionPopup" ) ) + { + bool wasDisconnectIssued = m_disconnectIssued; + bool discardData = !DrawConnection(); + bool disconnectIssuedJustNow = m_disconnectIssued != wasDisconnectIssued; + if( discardData ) + keepOpen = false; + if( disconnectIssuedJustNow || discardData ) + ImGui::CloseCurrentPopup(); + ImGui::EndPopup(); + } + ImGui::End(); m_zoneHighlight = nullptr; @@ -737,7 +754,6 @@ bool View::DrawConnection() std::shared_lock lock( m_worker.GetMbpsDataLock() ); char tmp[2048]; sprintf( tmp, "%s###Connection", m_worker.GetAddr().c_str() ); - ImGui::Begin( tmp, nullptr, ImGuiWindowFlags_AlwaysAutoResize ); const auto& mbpsVector = m_worker.GetMbpsData(); const auto mbps = mbpsVector.back(); char buf[64]; @@ -855,7 +871,6 @@ bool View::DrawConnection() { ImGui::CloseCurrentPopup(); ImGui::EndPopup(); - ImGui::End(); return false; } ImGui::SameLine( 0, ty * 2 ); @@ -866,7 +881,6 @@ bool View::DrawConnection() ImGui::EndPopup(); } - ImGui::End(); return true; } From 07da2e506a94bd71c51a6003793c549e1ee088c9 Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Sun, 4 Aug 2019 15:55:42 +0200 Subject: [PATCH 2/5] Fix deadlock problems. --- server/TracyView.cpp | 37 +++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/server/TracyView.cpp b/server/TracyView.cpp index 7ad4b900..42c5fe9f 100644 --- a/server/TracyView.cpp +++ b/server/TracyView.cpp @@ -458,15 +458,28 @@ bool View::DrawImpl() ImGui::Begin( tmp, keepOpenPtr, ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoBringToFrontOnFocus ); #endif - std::shared_lock lock( m_worker.GetDataLock() ); + if( !m_staticView ) + { #if defined TRACY_EXTENDED_FONT - const char* buttonTitle = ICON_FA_WIFI; + if( ImGui::Button( ICON_FA_WIFI ) ) #else - const char* buttonTitle = "Connection"; + if( ImGui::Button( "Connection" ) ) #endif - if ( ImGui::Button( buttonTitle ) ) - ImGui::OpenPopup( "TracyConnectionPopup" ); - ImGui::SameLine(); + { + ImGui::OpenPopup( "TracyConnectionPopup" ); + } + ImGui::SameLine(); + if( ImGui::BeginPopup( "TracyConnectionPopup" ) ) + { + const bool wasDisconnectIssued = m_disconnectIssued; + const bool discardData = !DrawConnection(); + const bool disconnectIssuedJustNow = m_disconnectIssued != wasDisconnectIssued; + if( discardData ) keepOpen = false; + if( disconnectIssuedJustNow || discardData ) ImGui::CloseCurrentPopup(); + ImGui::EndPopup(); + } + } + std::shared_lock lock( m_worker.GetDataLock() ); if( !m_worker.IsDataStatic() ) { if( m_worker.IsConnected() ) @@ -683,18 +696,6 @@ bool View::DrawImpl() DrawFrames(); DrawZones(); - if( ImGui::BeginPopup( "TracyConnectionPopup" ) ) - { - bool wasDisconnectIssued = m_disconnectIssued; - bool discardData = !DrawConnection(); - bool disconnectIssuedJustNow = m_disconnectIssued != wasDisconnectIssued; - if( discardData ) - keepOpen = false; - if( disconnectIssuedJustNow || discardData ) - ImGui::CloseCurrentPopup(); - ImGui::EndPopup(); - } - ImGui::End(); m_zoneHighlight = nullptr; From 853e9c17e36129e2024a2b9e929255442e01e32b Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Sun, 4 Aug 2019 15:56:52 +0200 Subject: [PATCH 3/5] Display client address. --- server/TracyView.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/server/TracyView.cpp b/server/TracyView.cpp index 42c5fe9f..b24ed0d2 100644 --- a/server/TracyView.cpp +++ b/server/TracyView.cpp @@ -753,8 +753,7 @@ bool View::DrawConnection() { std::shared_lock lock( m_worker.GetMbpsDataLock() ); - char tmp[2048]; - sprintf( tmp, "%s###Connection", m_worker.GetAddr().c_str() ); + TextFocused( "Connected to:", m_worker.GetAddr().c_str() ); const auto& mbpsVector = m_worker.GetMbpsData(); const auto mbps = mbpsVector.back(); char buf[64]; @@ -776,7 +775,7 @@ bool View::DrawConnection() ImGui::Text( "Memory usage: %s", MemSizeToString( memUsage.load( std::memory_order_relaxed ) ) ); const auto wpos = ImGui::GetWindowPos() + ImGui::GetWindowContentRegionMin(); - ImGui::GetWindowDrawList()->AddCircleFilled( wpos + ImVec2( 1 + cs * 0.5, 3 + ty * 0.5 ), cs * 0.5, m_worker.IsConnected() ? 0xFF2222CC : 0xFF444444, 10 ); + ImGui::GetWindowDrawList()->AddCircleFilled( wpos + ImVec2( 1 + cs * 0.5, 3 + ty * 1.75 ), cs * 0.5, m_worker.IsConnected() ? 0xFF2222CC : 0xFF444444, 10 ); { std::shared_lock lock( m_worker.GetDataLock() ); From d2490bb62bed8b85b71bf955bed76729ae31aab3 Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Sun, 4 Aug 2019 15:58:05 +0200 Subject: [PATCH 4/5] Update NEWS. --- NEWS | 1 + 1 file changed, 1 insertion(+) diff --git a/NEWS b/NEWS index d745150f..08e5f751 100644 --- a/NEWS +++ b/NEWS @@ -88,6 +88,7 @@ v0.5 (xxxx-xx-xx) - Added frame time target lines. - FPS counts are now displayed next to frame times. - GPU drift value can be now automatically measured. +- Connection window is now a popup hidden under a dedicated button. v0.4.1 (2018-12-30) ------------------- From 177b79a528b50ca0a84e4a68ee76ebb6bc6aef52 Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Sun, 4 Aug 2019 16:19:51 +0200 Subject: [PATCH 5/5] Update manual. --- manual/tracy.tex | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/manual/tracy.tex b/manual/tracy.tex index c5207aac..62590ad9 100644 --- a/manual/tracy.tex +++ b/manual/tracy.tex @@ -1171,14 +1171,17 @@ The \emph{discovered clients} list is only displayed if there are clients broadc Both connecting to a client and opening a saved trace will present you with the main profiler view, which you can use to analyze the data (see section~\ref{analyzingdata}). -If this is a real-time capture, you will also see the connection window (figure~\ref{connectioninfo}), with the capture status similar to the one displayed by the command line utility. This dialog also displays the connection speed graphed over time and the profiled application's current frames per second and frame time measurements. The \emph{Query backlog} represents the number of queries that were held back due to the bandwidth volume overwhelming the available network send buffer. While this number drains down to zero, the performance of real time profiling may be temporarily compromised. The circle displayed next to the bandwidth graph signals the connection status. If it's red, the connection is active. If it's gray, the client has disconnected. +\subsubsection{Connection information pop-up} +\label{connectionpopup} + +If this is a real-time capture, you will also have access to the connection information pop-up (figure~\ref{connectioninfo}) through the \emph{\faWifi{}~Connection} button, with the capture status similar to the one displayed by the command line utility. This dialog also displays the connection speed graphed over time and the profiled application's current frames per second and frame time measurements. The \emph{Query backlog} represents the number of queries that were held back due to the bandwidth volume overwhelming the available network send buffer. While this number drains down to zero, the performance of real time profiling may be temporarily compromised. The circle displayed next to the bandwidth graph signals the connection status. If it's red, the connection is active. If it's gray, the client has disconnected. You can use the \faSave{}~\emph{Save trace} button to save the current profile data to a file\footnote{This should be taken literally. If a live capture is in progress and a save is performed, some data may be missing from the capture and won't be saved.}. Use the \faPlug{}~\emph{Stop} button to disconnect from the client\footnote{While requesting disconnect stops retrieval of any new events, the profiler will wait for any data that is still pending for the current set of events.}. The \faExclamationTriangle{}~\emph{Discard} button is used to discard current trace. \begin{figure}[h] \centering\begin{tikzpicture} -\draw (0, 0) rectangle (6.1, -3.2); -\draw[pattern=crosshatch dots] (0, 0) rectangle+(6.1, 0.3); +\draw (0, 0.5) rectangle (6.1, -3.2); +\draw (0, 0.5) node[anchor=north west] {Connected to: 127.0.0.1}; \draw[pattern=north east lines] (0.35, -0.35) circle(0.2); \draw (0.7, -0.1) rectangle+(3.5, -0.5) node[midway] {Bandwidth graph}; \draw (4.3, -0.1) node[anchor=north west] {1.9 Mbps}; @@ -1190,7 +1193,7 @@ You can use the \faSave{}~\emph{Save trace} button to save the current profile d \draw[rounded corners=5pt] (2.6, -2.6) rectangle+(1.3, -0.5) node [midway] {\faPlug{}~Stop}; \draw[rounded corners=5pt] (4.0, -2.6) rectangle+(2, -0.5) node [midway] {\faExclamationTriangle{}~Discard}; \end{tikzpicture} -\caption{Connection information window.} +\caption{Connection information pop-up.} \label{connectioninfo} \end{figure} @@ -1278,6 +1281,7 @@ The main profiler window is split into three sections, as seen on figure~\ref{ma The control menu (top row of buttons) provides access to various features of the profiler. The buttons perform the following actions: \begin{itemize} +\item \emph{\faWifi{}~Connection} -- Opens the connection information popup (see section~\ref{connectionpopup}). Only available when live capture is in progress. \item \emph{\faPowerOff{} Close} -- This button unloads the current profiling trace and returns to the welcome menu, where another trace can be loaded. In live captures it is replaced by \emph{\faPause{}~Pause}, \emph{\faPlay{}~Resume} and \emph{\faSquare{}~Stopped} buttons. \item \emph{\faPause{} Pause} -- While a live capture is in progress, the profiler will display the last three fully captured frames, so that you can see the current behavior of the program. Use this button\footnote{Or perform any action on the timeline view.} to stop the automatic updates of the timeline view (the capture will be still progressing). \item \emph{\faPlay{} Resume} -- Use this button to resume following the most recent three frames in a live capture.