Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/wolfpld/tracy.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBartosz Taudul <wolf@nereid.pl>2021-11-27 16:42:23 +0300
committerBartosz Taudul <wolf@nereid.pl>2021-11-27 16:42:23 +0300
commit6a7b4e606627db7b01cfe90279f7354a99812d76 (patch)
tree63e04ecb935d488de0f93751635249aadbbe1d7e
parent85f755f3f55da5f3a036c5276eb14a43de7a0eda (diff)
Add calculation of child stats to source view.
-rw-r--r--server/TracySourceView.cpp53
-rw-r--r--server/TracySourceView.hpp2
2 files changed, 55 insertions, 0 deletions
diff --git a/server/TracySourceView.cpp b/server/TracySourceView.cpp
index 0bdaa45b..fab54dc6 100644
--- a/server/TracySourceView.cpp
+++ b/server/TracySourceView.cpp
@@ -4589,6 +4589,59 @@ void SourceView::GatherAdditionalIpStats( uint64_t baseAddr, AddrStatData& as, c
}
}
+void SourceView::GatherChildStats( uint64_t baseAddr, unordered_flat_map<uint64_t, uint32_t>& map, Worker& worker, bool limitView, const View& view )
+{
+ if( !worker.AreSymbolSamplesReady() ) return;
+ auto sym = worker.GetSymbolData( baseAddr );
+ if( !sym ) return;
+ if( limitView )
+ {
+ for( uint64_t ip = baseAddr; ip < baseAddr + sym->size.Val(); ip++ )
+ {
+ auto cp = worker.GetChildSamples( ip );
+ if( !cp ) continue;
+ auto it = std::lower_bound( cp->begin(), cp->end(), view.m_statRange.min, [] ( const auto& lhs, const auto& rhs ) { return lhs.time.Val() < rhs; } );
+ if( it == cp->end() ) continue;
+ auto end = std::lower_bound( it, cp->end(), view.m_statRange.max, [] ( const auto& lhs, const auto& rhs ) { return lhs.time.Val() < rhs; } );
+ while( it != end )
+ {
+ auto child = worker.GetSymbolForAddress( it->addr );
+ auto mit = map.find( child );
+ if( mit == map.end() )
+ {
+ map.emplace( child, 1 );
+ }
+ else
+ {
+ mit->second++;
+ }
+ ++it;
+ }
+ }
+ }
+ else
+ {
+ for( uint64_t ip = baseAddr; ip < baseAddr + sym->size.Val(); ip++ )
+ {
+ auto cp = worker.GetChildSamples( ip );
+ if( !cp ) continue;
+ for( auto& s : *cp )
+ {
+ auto child = worker.GetSymbolForAddress( s.addr );
+ auto mit = map.find( child );
+ if( mit == map.end() )
+ {
+ map.emplace( child, 1 );
+ }
+ else
+ {
+ mit->second++;
+ }
+ }
+ }
+ }
+}
+
uint32_t SourceView::CountAsmIpStats( uint64_t baseAddr, const Worker& worker, bool limitView, const View& view )
{
if( limitView )
diff --git a/server/TracySourceView.hpp b/server/TracySourceView.hpp
index fd736eff..2365d620 100644
--- a/server/TracySourceView.hpp
+++ b/server/TracySourceView.hpp
@@ -177,6 +177,8 @@ private:
void GatherIpHwStats( AddrStatData& as, Worker& worker, const View& view, CostType cost );
void GatherIpStats( uint64_t baseAddr, AddrStatData& as, const Worker& worker, bool limitView, const View& view );
void GatherAdditionalIpStats( uint64_t baseAddr, AddrStatData& as, const Worker& worker, bool limitView, const View& view );
+ void GatherChildStats( uint64_t baseAddr, unordered_flat_map<uint64_t, uint32_t>& vec, Worker& worker, bool limitView, const View& view );
+
uint32_t CountAsmIpStats( uint64_t baseAddr, const Worker& worker, bool limitView, const View& view );
void CountHwStats( AddrStatData& as, Worker& worker, const View& view );