From 8c494eabbf6eb2cb2604963b625e9234e25a8c67 Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Tue, 13 Aug 2019 00:29:09 +0200 Subject: [PATCH] Display number of context switch regions. --- server/TracyView.cpp | 1 + server/TracyWorker.cpp | 10 ++++++++++ server/TracyWorker.hpp | 1 + 3 files changed, 12 insertions(+) diff --git a/server/TracyView.cpp b/server/TracyView.cpp index 3348ac7a..3b083583 100644 --- a/server/TracyView.cpp +++ b/server/TracyView.cpp @@ -8602,6 +8602,7 @@ void View::DrawInfo() TextFocused( "Call stacks:", RealToString( m_worker.GetCallstackPayloadCount(), true ) ); 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::TreePop(); } diff --git a/server/TracyWorker.cpp b/server/TracyWorker.cpp index 3e3392a1..95c17625 100644 --- a/server/TracyWorker.cpp +++ b/server/TracyWorker.cpp @@ -1246,6 +1246,16 @@ uint64_t Worker::GetPlotCount() const return cnt; } +uint64_t Worker::GetContextSwitchCount() const +{ + uint64_t cnt = 0; + for( auto& v : m_data.ctxSwitch ) + { + cnt += v.second->v.size(); + } + return cnt; +} + const ContextSwitch* const Worker::GetContextSwitchData( uint64_t thread ) const { auto it = m_data.ctxSwitch.find( thread ); diff --git a/server/TracyWorker.hpp b/server/TracyWorker.hpp index 2dd942ce..359ae0b8 100644 --- a/server/TracyWorker.hpp +++ b/server/TracyWorker.hpp @@ -267,6 +267,7 @@ public: uint64_t GetZoneCount() const { return m_data.zonesCnt; } uint64_t GetLockCount() const; uint64_t GetPlotCount() const; + uint64_t GetContextSwitchCount() const; uint64_t GetSrcLocCount() const { return m_data.sourceLocationPayload.size() + m_data.sourceLocation.size(); } uint64_t GetCallstackPayloadCount() const { return m_data.callstackPayload.size() - 1; } uint64_t GetCallstackFrameCount() const { return m_data.callstackFrameMap.size(); }