From 227a8d1aee84c659b929d1344e3e3720dc0ba02e Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Thu, 20 May 2021 02:19:11 +0200 Subject: [PATCH] Process additional hardware sample data. --- server/TracyEvent.hpp | 4 ++++ server/TracyWorker.cpp | 40 ++++++++++++++++++++++++++++++++++++++++ server/TracyWorker.hpp | 4 ++++ 3 files changed, 48 insertions(+) diff --git a/server/TracyEvent.hpp b/server/TracyEvent.hpp index 950a7a03..d5e0e0ba 100644 --- a/server/TracyEvent.hpp +++ b/server/TracyEvent.hpp @@ -255,6 +255,10 @@ struct HwSampleData { uint32_t cycles; uint32_t retired; + uint32_t cacheRef; + uint32_t cacheMiss; + uint32_t branchRetired; + uint32_t branchMiss; }; enum { HwSampleDataSize = sizeof( HwSampleData ) }; diff --git a/server/TracyWorker.cpp b/server/TracyWorker.cpp index 9c632278..13e8546c 100644 --- a/server/TracyWorker.cpp +++ b/server/TracyWorker.cpp @@ -4467,6 +4467,18 @@ bool Worker::Process( const QueueItem& ev ) case QueueType::HwSampleInstructionRetired: ProcessHwSampleInstructionRetired( ev.hwSample ); break; + case QueueType::HwSampleCacheReference: + ProcessHwSampleCacheReference( ev.hwSample ); + break; + case QueueType::HwSampleCacheMiss: + ProcessHwSampleCacheMiss( ev.hwSample ); + break; + case QueueType::HwSampleBranchRetired: + ProcessHwSampleBranchRetired( ev.hwSample ); + break; + case QueueType::HwSampleBranchMiss: + ProcessHwSampleBranchMiss( ev.hwSample ); + break; case QueueType::ParamSetup: ProcessParamSetup( ev.paramSetup ); break; @@ -6288,6 +6300,34 @@ void Worker::ProcessHwSampleInstructionRetired( const QueueHwSample& ev ) it->second.retired++; } +void Worker::ProcessHwSampleCacheReference( const QueueHwSample& ev ) +{ + auto it = m_data.hwSamples.find( ev.ip ); + if( it == m_data.hwSamples.end() ) it = m_data.hwSamples.emplace( ev.ip, HwSampleData {} ).first; + it->second.cacheRef++; +} + +void Worker::ProcessHwSampleCacheMiss( const QueueHwSample& ev ) +{ + auto it = m_data.hwSamples.find( ev.ip ); + if( it == m_data.hwSamples.end() ) it = m_data.hwSamples.emplace( ev.ip, HwSampleData {} ).first; + it->second.cacheMiss++; +} + +void Worker::ProcessHwSampleBranchRetired( const QueueHwSample& ev ) +{ + auto it = m_data.hwSamples.find( ev.ip ); + if( it == m_data.hwSamples.end() ) it = m_data.hwSamples.emplace( ev.ip, HwSampleData {} ).first; + it->second.branchRetired++; +} + +void Worker::ProcessHwSampleBranchMiss( const QueueHwSample& ev ) +{ + auto it = m_data.hwSamples.find( ev.ip ); + if( it == m_data.hwSamples.end() ) it = m_data.hwSamples.emplace( ev.ip, HwSampleData {} ).first; + it->second.branchMiss++; +} + void Worker::ProcessParamSetup( const QueueParamSetup& ev ) { CheckString( ev.name ); diff --git a/server/TracyWorker.hpp b/server/TracyWorker.hpp index c03f19a6..c020127d 100644 --- a/server/TracyWorker.hpp +++ b/server/TracyWorker.hpp @@ -686,6 +686,10 @@ private: tracy_force_inline void ProcessTidToPid( const QueueTidToPid& ev ); tracy_force_inline void ProcessHwSampleCpuCycle( const QueueHwSample& ev ); tracy_force_inline void ProcessHwSampleInstructionRetired( const QueueHwSample& ev ); + tracy_force_inline void ProcessHwSampleCacheReference( const QueueHwSample& ev ); + tracy_force_inline void ProcessHwSampleCacheMiss( const QueueHwSample& ev ); + tracy_force_inline void ProcessHwSampleBranchRetired( const QueueHwSample& ev ); + tracy_force_inline void ProcessHwSampleBranchMiss( const QueueHwSample& ev ); tracy_force_inline void ProcessParamSetup( const QueueParamSetup& ev ); tracy_force_inline void ProcessCpuTopology( const QueueCpuTopology& ev ); tracy_force_inline void ProcessMemNamePayload( const QueueMemNamePayload& ev );