1
0
mirror of https://github.com/wolfpld/tracy synced 2025-05-08 07:53:52 +00:00

Move call stack paths calculation to a separate function.

This commit is contained in:
Bartosz Taudul 2019-02-06 13:46:50 +01:00
parent dbf8115771
commit c689a494da
2 changed files with 14 additions and 8 deletions

View File

@ -7652,15 +7652,8 @@ static tracy_force_inline CallstackFrameTree* GetFrameTreeItem( std::vector<Call
}
}
std::vector<CallstackFrameTree> View::GetCallstackFrameTree( const MemData& mem ) const
flat_hash_map<uint32_t, View::PathData, nohash<uint32_t>> View::GetCallstackPaths( const MemData& mem ) const
{
struct PathData
{
uint32_t cnt;
uint64_t mem;
};
std::vector<CallstackFrameTree> root;
flat_hash_map<uint32_t, PathData, nohash<uint32_t>> pathSum;
pathSum.reserve( m_worker.GetCallstackPayloadCount() );
@ -7682,7 +7675,13 @@ std::vector<CallstackFrameTree> View::GetCallstackFrameTree( const MemData& mem
it->second.mem += ev.size;
}
}
return pathSum;
}
std::vector<CallstackFrameTree> View::GetCallstackFrameTree( const MemData& mem ) const
{
std::vector<CallstackFrameTree> root;
auto pathSum = GetCallstackPaths( mem );
for( auto& path : pathSum )
{
auto& cs = m_worker.GetCallstack( path.first );

View File

@ -72,6 +72,12 @@ private:
enum { InvalidId = 0xFFFFFFFF };
struct PathData
{
uint32_t cnt;
uint64_t mem;
};
void InitTextEditor();
const char* ShortenNamespace( const char* name ) const;
@ -113,6 +119,7 @@ private:
template<class T>
void ListMemData( T ptr, T end, std::function<void(T&)> DrawAddress, const char* id = nullptr );
flat_hash_map<uint32_t, PathData, nohash<uint32_t>> GetCallstackPaths( const MemData& mem ) const;
std::vector<CallstackFrameTree> GetCallstackFrameTree( const MemData& mem ) const;
void DrawFrameTreeLevel( std::vector<CallstackFrameTree>& tree, int& idx );