1
0
mirror of https://github.com/wolfpld/tracy.git synced 2025-03-20 07:40:02 +08:00

Shared index for all call stack tree nodes.

This commit is contained in:
Bartosz Taudul 2018-08-17 22:31:55 +02:00
parent 17273c5987
commit 4e23ce9a24
2 changed files with 5 additions and 5 deletions

View File

@ -6500,7 +6500,8 @@ void View::DrawMemory()
auto& mem = m_worker.GetMemData(); auto& mem = m_worker.GetMemData();
auto tree = GetCallstackFrameTree( mem ); auto tree = GetCallstackFrameTree( mem );
DrawFrameTreeLevel( tree ); int idx = 0;
DrawFrameTreeLevel( tree, idx );
ImGui::TreePop(); ImGui::TreePop();
} }
@ -6508,11 +6509,10 @@ void View::DrawMemory()
ImGui::End(); ImGui::End();
} }
void View::DrawFrameTreeLevel( std::vector<CallstackFrameTree>& tree ) const void View::DrawFrameTreeLevel( std::vector<CallstackFrameTree>& tree, int& idx ) const
{ {
auto& io = ImGui::GetIO(); auto& io = ImGui::GetIO();
int idx = 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.allocInclusive > rhs.allocInclusive; } );
for( auto& v : tree ) for( auto& v : tree )
{ {
@ -6593,7 +6593,7 @@ void View::DrawFrameTreeLevel( std::vector<CallstackFrameTree>& tree ) const
if( expand ) if( expand )
{ {
DrawFrameTreeLevel( v.children ); DrawFrameTreeLevel( v.children, idx );
ImGui::TreePop(); ImGui::TreePop();
} }
} }

View File

@ -103,7 +103,7 @@ private:
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 );
std::vector<CallstackFrameTree> GetCallstackFrameTree( const MemData& mem ) const; std::vector<CallstackFrameTree> GetCallstackFrameTree( const MemData& mem ) const;
void DrawFrameTreeLevel( std::vector<CallstackFrameTree>& tree ) const; void DrawFrameTreeLevel( std::vector<CallstackFrameTree>& tree, int& idx ) const;
void DrawInfoWindow(); void DrawInfoWindow();
void DrawZoneInfoWindow(); void DrawZoneInfoWindow();