diff --git a/server/TracySourceView.cpp b/server/TracySourceView.cpp index 6c3f7768..1e75fa1f 100644 --- a/server/TracySourceView.cpp +++ b/server/TracySourceView.cpp @@ -3156,6 +3156,31 @@ void SourceView::GatherIpStats( uint64_t addr, uint32_t& iptotalSrc, uint32_t& i } } +uint32_t SourceView::CountAsmIpStats( uint64_t addr, const Worker& worker, bool limitView, const View& view ) +{ + if( limitView ) + { + auto vec = worker.GetSamplesForSymbol( addr ); + if( !vec ) return 0; + auto it = std::lower_bound( vec->begin(), vec->end(), view.m_statRange.min, [] ( const auto& lhs, const auto& rhs ) { return lhs.time.Val() < rhs; } ); + if( it == vec->end() ) return 0; + auto end = std::lower_bound( it, vec->end(), view.m_statRange.max, [] ( const auto& lhs, const auto& rhs ) { return lhs.time.Val() < rhs; } ); + return end - it; + } + else + { + uint32_t cnt = 0; + auto ipmap = worker.GetSymbolInstructionPointers( addr ); + if( !ipmap ) return 0; + for( auto& ip : *ipmap ) + { + auto addr = worker.GetCanonicalPointer( ip.first ); + cnt += ip.second; + } + return cnt; + } +} + namespace { static unordered_flat_set GetKeywords() { diff --git a/server/TracySourceView.hpp b/server/TracySourceView.hpp index 575d1622..62a25d57 100644 --- a/server/TracySourceView.hpp +++ b/server/TracySourceView.hpp @@ -159,6 +159,7 @@ private: void SelectAsmLinesHover( uint32_t file, uint32_t line, const Worker& worker ); void GatherIpStats( uint64_t addr, uint32_t& iptotalSrc, uint32_t& iptotalAsm, unordered_flat_map& ipcountSrc, unordered_flat_map& ipcountAsm, uint32_t& ipmaxSrc, uint32_t& ipmaxAsm, const Worker& worker, bool limitView, const View& view ); + uint32_t CountAsmIpStats( uint64_t addr, const Worker& worker, bool limitView, const View& view ); void SelectMicroArchitecture( const char* moniker );