mirror of
https://github.com/wolfpld/tracy
synced 2025-05-08 16:03:53 +00:00
Move call stack paths calculation to a separate function.
This commit is contained in:
parent
dbf8115771
commit
c689a494da
@ -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;
|
flat_hash_map<uint32_t, PathData, nohash<uint32_t>> pathSum;
|
||||||
pathSum.reserve( m_worker.GetCallstackPayloadCount() );
|
pathSum.reserve( m_worker.GetCallstackPayloadCount() );
|
||||||
|
|
||||||
@ -7682,7 +7675,13 @@ std::vector<CallstackFrameTree> View::GetCallstackFrameTree( const MemData& mem
|
|||||||
it->second.mem += ev.size;
|
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 )
|
for( auto& path : pathSum )
|
||||||
{
|
{
|
||||||
auto& cs = m_worker.GetCallstack( path.first );
|
auto& cs = m_worker.GetCallstack( path.first );
|
||||||
|
@ -72,6 +72,12 @@ private:
|
|||||||
|
|
||||||
enum { InvalidId = 0xFFFFFFFF };
|
enum { InvalidId = 0xFFFFFFFF };
|
||||||
|
|
||||||
|
struct PathData
|
||||||
|
{
|
||||||
|
uint32_t cnt;
|
||||||
|
uint64_t mem;
|
||||||
|
};
|
||||||
|
|
||||||
void InitTextEditor();
|
void InitTextEditor();
|
||||||
|
|
||||||
const char* ShortenNamespace( const char* name ) const;
|
const char* ShortenNamespace( const char* name ) const;
|
||||||
@ -113,6 +119,7 @@ private:
|
|||||||
template<class T>
|
template<class T>
|
||||||
void ListMemData( T ptr, T end, std::function<void(T&)> DrawAddress, const char* id = nullptr );
|
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;
|
std::vector<CallstackFrameTree> GetCallstackFrameTree( const MemData& mem ) const;
|
||||||
void DrawFrameTreeLevel( std::vector<CallstackFrameTree>& tree, int& idx );
|
void DrawFrameTreeLevel( std::vector<CallstackFrameTree>& tree, int& idx );
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user