mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-10 10:41:50 +00:00
Allow sorting groups by time.
This commit is contained in:
parent
59e0f3d490
commit
d1cef20c0b
@ -4230,21 +4230,6 @@ void View::DrawFindZone()
|
||||
ImGui::Separator();
|
||||
ImGui::Text( "Found zones:" );
|
||||
ImGui::SameLine();
|
||||
if( m_findZone.sortByCounts )
|
||||
{
|
||||
if( ImGui::SmallButton( "Sort by order" ) )
|
||||
{
|
||||
m_findZone.sortByCounts = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if( ImGui::SmallButton( "Sort by counts" ) )
|
||||
{
|
||||
m_findZone.sortByCounts = true;
|
||||
}
|
||||
}
|
||||
ImGui::SameLine();
|
||||
ImGui::TextDisabled( "(?)" );
|
||||
if( ImGui::IsItemHovered() )
|
||||
{
|
||||
@ -4259,6 +4244,8 @@ void View::DrawFindZone()
|
||||
m_findZone.ResetGroups();
|
||||
}
|
||||
|
||||
ImGui::Combo( "Sort by", (int*)( &m_findZone.sortBy ), "Order\0Count\0Time\0\0" );
|
||||
|
||||
auto& zones = m_worker.GetZonesForSourceLocation( m_findZone.match[m_findZone.selMatch] ).zones;
|
||||
auto sz = zones.size();
|
||||
auto processed = m_findZone.processed;
|
||||
@ -4318,9 +4305,20 @@ void View::DrawFindZone()
|
||||
{
|
||||
groups[idx++] = it;
|
||||
}
|
||||
if( m_findZone.sortByCounts )
|
||||
|
||||
switch( m_findZone.sortBy )
|
||||
{
|
||||
case FindZone::SortBy::Order:
|
||||
break;
|
||||
case FindZone::SortBy::Count:
|
||||
pdqsort_branchless( groups.begin(), groups.end(), []( const auto& lhs, const auto& rhs ) { return lhs->second.zones.size() > rhs->second.zones.size(); } );
|
||||
break;
|
||||
case FindZone::SortBy::Time:
|
||||
pdqsort_branchless( groups.begin(), groups.end(), []( const auto& lhs, const auto& rhs ) { return lhs->second.time > rhs->second.time; } );
|
||||
break;
|
||||
default:
|
||||
assert( false );
|
||||
break;
|
||||
}
|
||||
|
||||
ImGui::BeginChild( "##zonesScroll", ImVec2( ImGui::GetWindowContentRegionWidth(), std::max( 200.f, ImGui::GetContentRegionAvail().y ) ) );
|
||||
|
@ -220,6 +220,7 @@ private:
|
||||
struct FindZone {
|
||||
enum : uint64_t { Unselected = std::numeric_limits<uint64_t>::max() - 1 };
|
||||
enum class GroupBy : int { Thread, UserText, Callstack };
|
||||
enum class SortBy : int { Order, Count, Time };
|
||||
|
||||
struct Group
|
||||
{
|
||||
@ -238,7 +239,7 @@ private:
|
||||
bool logTime = true;
|
||||
bool cumulateTime = false;
|
||||
GroupBy groupBy = GroupBy::Thread;
|
||||
bool sortByCounts = false;
|
||||
SortBy sortBy = SortBy::Order;
|
||||
Region highlight;
|
||||
int64_t numBins = -1;
|
||||
std::unique_ptr<int64_t[]> bins, binTime, selBin;
|
||||
|
Loading…
Reference in New Issue
Block a user