From 8bc4258e295db520d3795d1b1b2427cdb977d6a0 Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Fri, 16 Aug 2019 16:36:33 +0200 Subject: [PATCH] Display count of per-cpu context switch data. --- server/TracyView.cpp | 2 ++ server/TracyWorker.cpp | 10 ++++++++++ server/TracyWorker.hpp | 1 + 3 files changed, 13 insertions(+) diff --git a/server/TracyView.cpp b/server/TracyView.cpp index 3c7b9d74..38fc9be2 100644 --- a/server/TracyView.cpp +++ b/server/TracyView.cpp @@ -9154,6 +9154,8 @@ void View::DrawInfo() TextFocused( "Call stack frames:", RealToString( m_worker.GetCallstackFrameCount(), true ) ); TextFocused( "Frame images:", RealToString( ficnt, true ) ); TextFocused( "Context switch regions:", RealToString( m_worker.GetContextSwitchCount(), true ) ); + ImGui::SameLine(); + TextFocused( "+", RealToString( m_worker.GetContextSwitchPerCpuCount(), true ) ); ImGui::TreePop(); } diff --git a/server/TracyWorker.cpp b/server/TracyWorker.cpp index 2bae4c07..b8870817 100644 --- a/server/TracyWorker.cpp +++ b/server/TracyWorker.cpp @@ -1553,6 +1553,16 @@ uint64_t Worker::GetContextSwitchCount() const return cnt; } +uint64_t Worker::GetContextSwitchPerCpuCount() const +{ + uint64_t cnt = 0; + for( int i=0; i<256; i++ ) + { + cnt += m_data.cpuData[i].cs.size(); + } + return cnt; +} + const ContextSwitch* const Worker::GetContextSwitchDataImpl( uint64_t thread ) { auto it = m_data.ctxSwitch.find( thread ); diff --git a/server/TracyWorker.hpp b/server/TracyWorker.hpp index 1b6c46f3..fa8b1cc7 100644 --- a/server/TracyWorker.hpp +++ b/server/TracyWorker.hpp @@ -281,6 +281,7 @@ public: uint64_t GetLockCount() const; uint64_t GetPlotCount() const; uint64_t GetContextSwitchCount() const; + uint64_t GetContextSwitchPerCpuCount() const; bool HasContextSwitches() const { return !m_data.ctxSwitch.empty(); } uint64_t GetSrcLocCount() const { return m_data.sourceLocationPayload.size() + m_data.sourceLocation.size(); } uint64_t GetCallstackPayloadCount() const { return m_data.callstackPayload.size() - 1; }