1
0
mirror of https://github.com/wolfpld/tracy synced 2025-04-29 20:33:52 +00:00

Extract DrawSamplesStatistics()

This commit is contained in:
xavier 2021-09-04 16:03:42 +02:00
parent 4c220bdc14
commit 6b901a7156
2 changed files with 394 additions and 385 deletions

View File

@ -12810,13 +12810,6 @@ void View::DrawStatistics()
const auto& symMap = m_worker.GetSymbolMap(); const auto& symMap = m_worker.GetSymbolMap();
const auto& symStat = m_worker.GetSymbolStats(); const auto& symStat = m_worker.GetSymbolStats();
struct SymList
{
uint64_t symAddr;
uint32_t incl, excl;
uint32_t count;
};
Vector<SymList> data; Vector<SymList> data;
if( m_showAllSymbols ) if( m_showAllSymbols )
{ {
@ -13000,6 +12993,15 @@ void View::DrawStatistics()
} }
} }
DrawSamplesStatistics(data, timeRange);
}
#endif
ImGui::End();
}
void View::DrawSamplesStatistics(Vector<SymList>& data, int64_t timeRange)
{
static unordered_flat_map<uint64_t, SymList> inlineMap; static unordered_flat_map<uint64_t, SymList> inlineMap;
assert( inlineMap.empty() ); assert( inlineMap.empty() );
if( !m_statSeparateInlines ) if( !m_statSeparateInlines )
@ -13038,6 +13040,8 @@ void View::DrawStatistics()
} }
else else
{ {
const auto& symMap = m_worker.GetSymbolMap();
if( m_statAccumulationMode == AccumulationMode::SelfOnly ) if( m_statAccumulationMode == AccumulationMode::SelfOnly )
{ {
pdqsort_branchless( data.begin(), data.end(), []( const auto& l, const auto& r ) { return l.excl != r.excl ? l.excl > r.excl : l.symAddr < r.symAddr; } ); pdqsort_branchless( data.begin(), data.end(), []( const auto& l, const auto& r ) { return l.excl != r.excl ? l.excl > r.excl : l.symAddr < r.symAddr; } );
@ -13457,9 +13461,6 @@ void View::DrawStatistics()
inlineMap.clear(); inlineMap.clear();
} }
} }
#endif
ImGui::End();
}
void View::DrawCallstackWindow() void View::DrawCallstackWindow()
{ {

View File

@ -153,6 +153,13 @@ private:
bool highlight; bool highlight;
}; };
struct SymList
{
uint64_t symAddr;
uint32_t incl, excl;
uint32_t count;
};
void InitMemory(); void InitMemory();
void InitTextEditor( ImFont* font ); void InitTextEditor( ImFont* font );
@ -196,6 +203,7 @@ private:
void DrawFindZone(); void DrawFindZone();
void AccumulationModeComboBox(); void AccumulationModeComboBox();
void DrawStatistics(); void DrawStatistics();
void DrawSamplesStatistics(Vector<SymList>& data, int64_t timeRange);
void DrawMemory(); void DrawMemory();
void DrawAllocList(); void DrawAllocList();
void DrawCompare(); void DrawCompare();