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

Different ways of sorting of statistics data.

This commit is contained in:
Bartosz Taudul 2018-03-24 17:28:10 +01:00
parent 0e1e1b4d06
commit ae274d8e37
2 changed files with 20 additions and 4 deletions

View File

@ -204,6 +204,7 @@ View::View( FileRead& f )
, m_drawLocks( true ) , m_drawLocks( true )
, m_drawPlots( true ) , m_drawPlots( true )
, m_onlyContendedLocks( false ) , m_onlyContendedLocks( false )
, m_statSort( 0 )
, m_namespace( Namespace::Full ) , m_namespace( Namespace::Full )
{ {
assert( s_instance == nullptr ); assert( s_instance == nullptr );
@ -3469,7 +3470,21 @@ void View::DrawStatistics()
srcloc.push_back_no_space_check( it ); srcloc.push_back_no_space_check( it );
} }
} }
pdqsort_branchless( srcloc.begin(), srcloc.end(), []( const auto& lhs, const auto& rhs ) { return lhs->second.total > rhs->second.total; } ); switch( m_statSort )
{
case 0:
pdqsort_branchless( srcloc.begin(), srcloc.end(), []( const auto& lhs, const auto& rhs ) { return lhs->second.total > rhs->second.total; } );
break;
case 1:
pdqsort_branchless( srcloc.begin(), srcloc.end(), []( const auto& lhs, const auto& rhs ) { return lhs->second.zones.size() > rhs->second.zones.size(); } );
break;
case 2:
pdqsort_branchless( srcloc.begin(), srcloc.end(), []( const auto& lhs, const auto& rhs ) { return lhs->second.total / lhs->second.zones.size() > rhs->second.total / rhs->second.zones.size(); } );
break;
default:
assert( false );
break;
}
ImGui::Text( "Recorded source locations: %s", RealToString( srcloc.size(), true ) ); ImGui::Text( "Recorded source locations: %s", RealToString( srcloc.size(), true ) );
@ -3479,11 +3494,11 @@ void View::DrawStatistics()
ImGui::NextColumn(); ImGui::NextColumn();
ImGui::Text( "Location" ); ImGui::Text( "Location" );
ImGui::NextColumn(); ImGui::NextColumn();
ImGui::Text( "Total time" ); if( ImGui::Button( "Total time" ) ) m_statSort = 0;
ImGui::NextColumn(); ImGui::NextColumn();
ImGui::Text( "Counts" ); if( ImGui::Button( "Counts" ) ) m_statSort = 1;
ImGui::NextColumn(); ImGui::NextColumn();
ImGui::Text( "MTPC" ); if( ImGui::Button( "MTPC" ) ) m_statSort = 2;
ImGui::SameLine(); ImGui::SameLine();
ImGui::TextDisabled( "(?)" ); ImGui::TextDisabled( "(?)" );
if( ImGui::IsItemHovered() ) if( ImGui::IsItemHovered() )

View File

@ -164,6 +164,7 @@ private:
bool m_drawLocks; bool m_drawLocks;
bool m_drawPlots; bool m_drawPlots;
bool m_onlyContendedLocks; bool m_onlyContendedLocks;
int m_statSort;
Namespace m_namespace; Namespace m_namespace;
Animation m_zoomAnim; Animation m_zoomAnim;