mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-10 10:41:50 +00:00
Different sorting modes for zone time distribution.
This commit is contained in:
parent
f03b7f33ed
commit
6ced346e08
@ -6090,7 +6090,6 @@ void View::DrawZoneInfoWindow()
|
|||||||
std::vector<flat_hash_map<int16_t, ZoneTimeData, nohash<uint16_t>>::const_iterator> vec;
|
std::vector<flat_hash_map<int16_t, ZoneTimeData, nohash<uint16_t>>::const_iterator> vec;
|
||||||
vec.reserve( data.size() );
|
vec.reserve( data.size() );
|
||||||
for( auto it = data.cbegin(); it != data.cend(); ++it ) vec.emplace_back( it );
|
for( auto it = data.cbegin(); it != data.cend(); ++it ) vec.emplace_back( it );
|
||||||
pdqsort_branchless( vec.begin(), vec.end(), []( const auto& lhs, const auto& rhs ) { return lhs->second.time > rhs->second.time; } );
|
|
||||||
static bool widthSet = false;
|
static bool widthSet = false;
|
||||||
ImGui::Columns( 3 );
|
ImGui::Columns( 3 );
|
||||||
if( !widthSet )
|
if( !widthSet )
|
||||||
@ -6101,13 +6100,28 @@ void View::DrawZoneInfoWindow()
|
|||||||
ImGui::SetColumnWidth( 1, w * 0.25f );
|
ImGui::SetColumnWidth( 1, w * 0.25f );
|
||||||
ImGui::SetColumnWidth( 2, w * 0.18f );
|
ImGui::SetColumnWidth( 2, w * 0.18f );
|
||||||
}
|
}
|
||||||
ImGui::TextUnformatted( "Zone" );
|
if( ImGui::SmallButton( "Zone" ) ) m_timeDist.sortBy = TimeDistribution::SortBy::Count;
|
||||||
ImGui::NextColumn();
|
ImGui::NextColumn();
|
||||||
ImGui::TextUnformatted( "Time" );
|
if( ImGui::SmallButton( "Time" ) ) m_timeDist.sortBy = TimeDistribution::SortBy::Time;
|
||||||
ImGui::NextColumn();
|
ImGui::NextColumn();
|
||||||
ImGui::TextUnformatted( "MTPC" );
|
if( ImGui::SmallButton( "MTPC" ) ) m_timeDist.sortBy = TimeDistribution::SortBy::Mtpc;
|
||||||
ImGui::NextColumn();
|
ImGui::NextColumn();
|
||||||
ImGui::Separator();
|
ImGui::Separator();
|
||||||
|
switch( m_timeDist.sortBy )
|
||||||
|
{
|
||||||
|
case TimeDistribution::SortBy::Count:
|
||||||
|
pdqsort_branchless( vec.begin(), vec.end(), []( const auto& lhs, const auto& rhs ) { return lhs->second.count > rhs->second.count; } );
|
||||||
|
break;
|
||||||
|
case TimeDistribution::SortBy::Time:
|
||||||
|
pdqsort_branchless( vec.begin(), vec.end(), []( const auto& lhs, const auto& rhs ) { return lhs->second.time > rhs->second.time; } );
|
||||||
|
break;
|
||||||
|
case TimeDistribution::SortBy::Mtpc:
|
||||||
|
pdqsort_branchless( vec.begin(), vec.end(), []( const auto& lhs, const auto& rhs ) { return float( lhs->second.time ) / lhs->second.count > float( rhs->second.time ) / rhs->second.count; } );
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
assert( false );
|
||||||
|
break;
|
||||||
|
}
|
||||||
const auto fztime = 100.f / ztime;
|
const auto fztime = 100.f / ztime;
|
||||||
for( auto& v : vec )
|
for( auto& v : vec )
|
||||||
{
|
{
|
||||||
|
@ -561,6 +561,11 @@ private:
|
|||||||
bool sync = false;
|
bool sync = false;
|
||||||
bool zoom = false;
|
bool zoom = false;
|
||||||
} m_playback;
|
} m_playback;
|
||||||
|
|
||||||
|
struct TimeDistribution {
|
||||||
|
enum class SortBy : int { Count, Time, Mtpc };
|
||||||
|
SortBy sortBy = SortBy::Time;
|
||||||
|
} m_timeDist;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user