mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-23 14:54:34 +00:00
Let's not search in a map.
This commit is contained in:
parent
bd96c2ce51
commit
79c437ba7f
@ -6476,15 +6476,15 @@ static tracy_force_inline CallstackFrameTree* GetFrameTreeItem( std::vector<Call
|
|||||||
std::vector<CallstackFrameTree> View::GetCallstackFrameTree( const MemData& mem ) const
|
std::vector<CallstackFrameTree> View::GetCallstackFrameTree( const MemData& mem ) const
|
||||||
{
|
{
|
||||||
std::vector<CallstackFrameTree> root;
|
std::vector<CallstackFrameTree> root;
|
||||||
flat_hash_map<uint32_t, std::vector<uint32_t>, nohash<uint32_t>> paths;
|
std::vector<Vector<uint32_t>> paths;
|
||||||
|
paths.resize( m_worker.GetCallstackPayloadCount() );
|
||||||
|
|
||||||
for( auto& ev : mem.data )
|
for( auto& ev : mem.data )
|
||||||
{
|
{
|
||||||
if( ev.csAlloc == 0 ) continue;
|
if( ev.csAlloc == 0 ) continue;
|
||||||
auto it = paths.find( ev.csAlloc );
|
auto& path = paths[ev.csAlloc];
|
||||||
if( it != paths.end() )
|
if( !path.empty() )
|
||||||
{
|
{
|
||||||
const auto& path = it->second;
|
|
||||||
auto treePtr = &root;
|
auto treePtr = &root;
|
||||||
CallstackFrameTree* node = nullptr;
|
CallstackFrameTree* node = nullptr;
|
||||||
for( auto& v : path )
|
for( auto& v : path )
|
||||||
@ -6501,28 +6501,28 @@ std::vector<CallstackFrameTree> View::GetCallstackFrameTree( const MemData& mem
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
auto& cs = m_worker.GetCallstack( ev.csAlloc );
|
auto& cs = m_worker.GetCallstack( ev.csAlloc );
|
||||||
std::vector<uint32_t> path;
|
Vector<uint32_t> path;
|
||||||
path.reserve( cs.size() );
|
path.reserve( cs.size() );
|
||||||
|
|
||||||
auto base = cs.back();
|
auto base = cs.back();
|
||||||
auto treePtr = GetFrameTreeItem( root, base );
|
auto treePtr = GetFrameTreeItem( root, base );
|
||||||
treePtr->countInclusive++;
|
treePtr->countInclusive++;
|
||||||
treePtr->allocInclusive += ev.size;
|
treePtr->allocInclusive += ev.size;
|
||||||
path.emplace_back( uint32_t( treePtr - root.data() ) );
|
path.push_back( uint32_t( treePtr - root.data() ) );
|
||||||
|
|
||||||
for( int i = int( cs.size() ) - 2; i >= 0; i-- )
|
for( int i = int( cs.size() ) - 2; i >= 0; i-- )
|
||||||
{
|
{
|
||||||
auto newTreePtr = GetFrameTreeItem( treePtr->children, cs[i] );
|
auto newTreePtr = GetFrameTreeItem( treePtr->children, cs[i] );
|
||||||
newTreePtr->countInclusive++;
|
newTreePtr->countInclusive++;
|
||||||
newTreePtr->allocInclusive += ev.size;
|
newTreePtr->allocInclusive += ev.size;
|
||||||
path.emplace_back( uint32_t( newTreePtr - treePtr->children.data() ) );
|
path.push_back( uint32_t( newTreePtr - treePtr->children.data() ) );
|
||||||
treePtr = newTreePtr;
|
treePtr = newTreePtr;
|
||||||
}
|
}
|
||||||
|
|
||||||
treePtr->countExclusive++;
|
treePtr->countExclusive++;
|
||||||
treePtr->allocExclusive += ev.size;
|
treePtr->allocExclusive += ev.size;
|
||||||
|
|
||||||
paths.emplace( ev.csAlloc, std::move( path ) );
|
paths[ev.csAlloc] = std::move( path );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return root;
|
return root;
|
||||||
|
Loading…
Reference in New Issue
Block a user