mirror of
https://github.com/wolfpld/tracy.git
synced 2025-03-20 07:40:02 +08:00
Don't separate inclusive/exclusive counts.
There is no way for one frame to have both. Coloring is preserved and is now determined by presence of children.
This commit is contained in:
parent
1953a1a1d5
commit
b945f83169
@ -183,8 +183,8 @@ enum { CallstackFrameDataSize = sizeof( CallstackFrameData ) };
|
|||||||
struct CallstackFrameTree
|
struct CallstackFrameTree
|
||||||
{
|
{
|
||||||
uint64_t frame;
|
uint64_t frame;
|
||||||
uint64_t allocExclusive, allocInclusive;
|
uint64_t alloc;
|
||||||
uint32_t countExclusive, countInclusive;
|
uint32_t count;
|
||||||
std::vector<CallstackFrameTree> children;
|
std::vector<CallstackFrameTree> children;
|
||||||
flat_hash_set<uint32_t, nohash<uint32_t>> callstacks;
|
flat_hash_set<uint32_t, nohash<uint32_t>> callstacks;
|
||||||
};
|
};
|
||||||
|
|||||||
@ -7718,20 +7718,17 @@ std::vector<CallstackFrameTree> View::GetCallstackFrameTreeBottomUp( const MemDa
|
|||||||
|
|
||||||
auto base = cs.back();
|
auto base = cs.back();
|
||||||
auto treePtr = GetFrameTreeItem( root, base, m_worker, m_groupCallstackTreeByNameBottomUp );
|
auto treePtr = GetFrameTreeItem( root, base, m_worker, m_groupCallstackTreeByNameBottomUp );
|
||||||
treePtr->countInclusive += path.second.cnt;
|
treePtr->count += path.second.cnt;
|
||||||
treePtr->allocInclusive += path.second.mem;
|
treePtr->alloc += path.second.mem;
|
||||||
treePtr->callstacks.emplace( path.first );
|
treePtr->callstacks.emplace( path.first );
|
||||||
|
|
||||||
for( int i = int( cs.size() ) - 2; i >= 0; i-- )
|
for( int i = int( cs.size() ) - 2; i >= 0; i-- )
|
||||||
{
|
{
|
||||||
treePtr = GetFrameTreeItem( treePtr->children, cs[i], m_worker, m_groupCallstackTreeByNameBottomUp );
|
treePtr = GetFrameTreeItem( treePtr->children, cs[i], m_worker, m_groupCallstackTreeByNameBottomUp );
|
||||||
treePtr->countInclusive += path.second.cnt;
|
treePtr->count += path.second.cnt;
|
||||||
treePtr->allocInclusive += path.second.mem;
|
treePtr->alloc += path.second.mem;
|
||||||
treePtr->callstacks.emplace( path.first );
|
treePtr->callstacks.emplace( path.first );
|
||||||
}
|
}
|
||||||
|
|
||||||
treePtr->countExclusive += path.second.cnt;
|
|
||||||
treePtr->allocExclusive += path.second.mem;
|
|
||||||
}
|
}
|
||||||
return root;
|
return root;
|
||||||
}
|
}
|
||||||
@ -7746,20 +7743,17 @@ std::vector<CallstackFrameTree> View::GetCallstackFrameTreeTopDown( const MemDat
|
|||||||
|
|
||||||
auto base = cs.front();
|
auto base = cs.front();
|
||||||
auto treePtr = GetFrameTreeItem( root, base, m_worker, m_groupCallstackTreeByNameTopDown );
|
auto treePtr = GetFrameTreeItem( root, base, m_worker, m_groupCallstackTreeByNameTopDown );
|
||||||
treePtr->countInclusive += path.second.cnt;
|
treePtr->count += path.second.cnt;
|
||||||
treePtr->allocInclusive += path.second.mem;
|
treePtr->alloc += path.second.mem;
|
||||||
treePtr->callstacks.emplace( path.first );
|
treePtr->callstacks.emplace( path.first );
|
||||||
|
|
||||||
for( int i = 1; i < cs.size(); i++ )
|
for( int i = 1; i < cs.size(); i++ )
|
||||||
{
|
{
|
||||||
treePtr = GetFrameTreeItem( treePtr->children, cs[i], m_worker, m_groupCallstackTreeByNameTopDown );
|
treePtr = GetFrameTreeItem( treePtr->children, cs[i], m_worker, m_groupCallstackTreeByNameTopDown );
|
||||||
treePtr->countInclusive += path.second.cnt;
|
treePtr->count += path.second.cnt;
|
||||||
treePtr->allocInclusive += path.second.mem;
|
treePtr->alloc += path.second.mem;
|
||||||
treePtr->callstacks.emplace( path.first );
|
treePtr->callstacks.emplace( path.first );
|
||||||
}
|
}
|
||||||
|
|
||||||
treePtr->countExclusive += path.second.cnt;
|
|
||||||
treePtr->allocExclusive += path.second.mem;
|
|
||||||
}
|
}
|
||||||
return root;
|
return root;
|
||||||
}
|
}
|
||||||
@ -8110,7 +8104,7 @@ void View::DrawFrameTreeLevel( std::vector<CallstackFrameTree>& tree, int& idx )
|
|||||||
auto& io = ImGui::GetIO();
|
auto& io = ImGui::GetIO();
|
||||||
|
|
||||||
int lidx = 0;
|
int lidx = 0;
|
||||||
pdqsort_branchless( tree.begin(), tree.end(), [] ( const auto& lhs, const auto& rhs ) { return lhs.allocInclusive > rhs.allocInclusive; } );
|
pdqsort_branchless( tree.begin(), tree.end(), [] ( const auto& lhs, const auto& rhs ) { return lhs.alloc > rhs.alloc; } );
|
||||||
for( auto& v : tree )
|
for( auto& v : tree )
|
||||||
{
|
{
|
||||||
idx++;
|
idx++;
|
||||||
@ -8155,43 +8149,10 @@ void View::DrawFrameTreeLevel( std::vector<CallstackFrameTree>& tree, int& idx )
|
|||||||
if( io.KeyCtrl && ImGui::IsItemHovered() )
|
if( io.KeyCtrl && ImGui::IsItemHovered() )
|
||||||
{
|
{
|
||||||
ImGui::BeginTooltip();
|
ImGui::BeginTooltip();
|
||||||
|
TextFocused( "Allocations size:", MemSizeToString( v.alloc ) );
|
||||||
ImGui::TextColored( ImVec4( 0.4, 0.4, 0.1, 1.0 ), "Inclusive alloc size:" );
|
TextFocused( "Allocations count:", RealToString( v.count, true ) );
|
||||||
|
TextFocused( "Average allocation size:", MemSizeToString( v.alloc / v.count ) );
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
ImGui::TextColored( ImVec4( 0.8, 0.8, 0.2, 1.0 ), "%s", MemSizeToString( v.allocInclusive ) );
|
|
||||||
ImGui::SameLine();
|
|
||||||
ImGui::TextColored( ImVec4( 0.4, 0.4, 0.1, 1.0 ), "count:" );
|
|
||||||
ImGui::SameLine();
|
|
||||||
ImGui::TextColored( ImVec4( 0.8, 0.8, 0.2, 1.0 ), "%s", RealToString( v.countInclusive, true ) );
|
|
||||||
ImGui::TextColored( ImVec4( 0.4, 0.4, 0.1, 1.0 ), "Average inclusive alloc size:" );
|
|
||||||
ImGui::SameLine();
|
|
||||||
if( v.countInclusive != 0 )
|
|
||||||
{
|
|
||||||
ImGui::TextColored( ImVec4( 0.8, 0.8, 0.2, 1.0 ), "%s", MemSizeToString( v.allocInclusive / v.countInclusive ) );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ImGui::TextColored( ImVec4( 0.8, 0.8, 0.2, 1.0 ), "-" );
|
|
||||||
}
|
|
||||||
|
|
||||||
ImGui::TextColored( ImVec4( 0.1, 0.4, 0.4, 1.0 ), "Exclusive alloc size:" );
|
|
||||||
ImGui::SameLine();
|
|
||||||
ImGui::TextColored( ImVec4( 0.2, 0.8, 0.8, 1.0 ), "%s", MemSizeToString( v.allocExclusive ) );
|
|
||||||
ImGui::SameLine();
|
|
||||||
ImGui::TextColored( ImVec4( 0.1, 0.4, 0.4, 1.0 ), "count:" );
|
|
||||||
ImGui::SameLine();
|
|
||||||
ImGui::TextColored( ImVec4( 0.2, 0.8, 0.8, 1.0 ), "%s", RealToString( v.countExclusive, true ) );
|
|
||||||
ImGui::TextColored( ImVec4( 0.1, 0.4, 0.4, 1.0 ), "Average exclusive alloc size:" );
|
|
||||||
ImGui::SameLine();
|
|
||||||
if( v.countExclusive != 0 )
|
|
||||||
{
|
|
||||||
ImGui::TextColored( ImVec4( 0.2, 0.8, 0.8, 1.0 ), "%s", MemSizeToString( v.allocExclusive / v.countExclusive ) );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ImGui::TextColored( ImVec4( 0.2, 0.8, 0.8, 1.0 ), "-" );
|
|
||||||
}
|
|
||||||
|
|
||||||
ImGui::EndTooltip();
|
ImGui::EndTooltip();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -8219,19 +8180,14 @@ void View::DrawFrameTreeLevel( std::vector<CallstackFrameTree>& tree, int& idx )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( v.allocExclusive != v.allocInclusive )
|
ImGui::SameLine();
|
||||||
|
if( v.children.empty() )
|
||||||
{
|
{
|
||||||
ImGui::SameLine();
|
ImGui::TextColored( ImVec4( 0.2, 0.8, 0.8, 1.0 ), "%s (%s)", MemSizeToString( v.alloc ), RealToString( v.count, true ) );
|
||||||
ImGui::TextColored( ImVec4( 0.4, 0.4, 0.1, 1.0 ), "I:" );
|
|
||||||
ImGui::SameLine();
|
|
||||||
ImGui::TextColored( ImVec4( 0.8, 0.8, 0.2, 1.0 ), "%s (%s)", MemSizeToString( v.allocInclusive ), RealToString( v.countInclusive, true ) );
|
|
||||||
}
|
}
|
||||||
if( v.allocExclusive != 0 )
|
else
|
||||||
{
|
{
|
||||||
ImGui::SameLine();
|
ImGui::TextColored( ImVec4( 0.8, 0.8, 0.2, 1.0 ), "%s (%s)", MemSizeToString( v.alloc ), RealToString( v.count, true ) );
|
||||||
ImGui::TextColored( ImVec4( 0.1, 0.4, 0.4, 1.0 ), "E:" );
|
|
||||||
ImGui::SameLine();
|
|
||||||
ImGui::TextColored( ImVec4( 0.2, 0.8, 0.8, 1.0 ), "%s (%s)", MemSizeToString( v.allocExclusive ), RealToString( v.countExclusive, true ) );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if( expand )
|
if( expand )
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user