mirror of
https://github.com/wolfpld/tracy.git
synced 2025-03-20 07:40:02 +08:00
Cleanup
This commit is contained in:
parent
92c872dfc0
commit
59ae188a7f
@ -5669,11 +5669,11 @@ void View::DrawFindZone()
|
|||||||
{
|
{
|
||||||
ImGui::Columns( 3, hdrString );
|
ImGui::Columns( 3, hdrString );
|
||||||
ImGui::Separator();
|
ImGui::Separator();
|
||||||
if( ImGui::SmallButton( "Time from start" ) ) m_findZoneSort = 0;
|
if( ImGui::SmallButton( "Time from start" ) ) m_findZone.tableSortBy = FindZone::TableSortBy::Starttime;
|
||||||
ImGui::NextColumn();
|
ImGui::NextColumn();
|
||||||
if( ImGui::SmallButton( "Execution time" ) ) m_findZoneSort = 1;
|
if( ImGui::SmallButton( "Execution time" ) ) m_findZone.tableSortBy = FindZone::TableSortBy::Runtime;
|
||||||
ImGui::NextColumn();
|
ImGui::NextColumn();
|
||||||
if( ImGui::SmallButton( "Name" ) ) m_findZoneSort = 2;
|
if( ImGui::SmallButton( "Name" ) ) m_findZone.tableSortBy = FindZone::TableSortBy::Name;
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
ImGui::TextDisabled( "(?)" );
|
ImGui::TextDisabled( "(?)" );
|
||||||
if( ImGui::IsItemHovered() )
|
if( ImGui::IsItemHovered() )
|
||||||
@ -5685,37 +5685,45 @@ void View::DrawFindZone()
|
|||||||
ImGui::NextColumn();
|
ImGui::NextColumn();
|
||||||
ImGui::Separator();
|
ImGui::Separator();
|
||||||
|
|
||||||
|
Vector<ZoneEvent*>* zonesToIterate = &v->second.zones;
|
||||||
Vector<ZoneEvent*> sortedZones;
|
Vector<ZoneEvent*> sortedZones;
|
||||||
sortedZones.reserve_and_use( v->second.zones.size() );
|
|
||||||
std::copy(v->second.zones.begin(), v->second.zones.end(), sortedZones.begin());
|
|
||||||
|
|
||||||
|
if ( m_findZone.tableSortBy != FindZone::TableSortBy::Starttime )
|
||||||
switch( m_findZoneSort )
|
|
||||||
{
|
{
|
||||||
case 0:
|
zonesToIterate = &sortedZones;
|
||||||
//Already sorted by time from start
|
sortedZones.reserve_and_use( v->second.zones.size() );
|
||||||
break;
|
std::copy(v->second.zones.begin(), v->second.zones.end(), sortedZones.begin());
|
||||||
case 1:
|
|
||||||
if( m_findZone.selfTime )
|
|
||||||
pdqsort_branchless( sortedZones.begin(), sortedZones.end(), [this]( const auto& lhs, const auto& rhs ) { return (m_worker.GetZoneEndDirect( *lhs ) - lhs->start - GetZoneChildTimeFast( *lhs )) > (m_worker.GetZoneEndDirect( *rhs ) - rhs->start - GetZoneChildTimeFast( *rhs )); } );
|
switch( m_findZone.tableSortBy )
|
||||||
else
|
{
|
||||||
pdqsort_branchless( sortedZones.begin(), sortedZones.end(), [this]( const auto& lhs, const auto& rhs ) { return (m_worker.GetZoneEndDirect( *lhs ) - lhs->start) > (m_worker.GetZoneEndDirect( *rhs ) - rhs->start); } );
|
case FindZone::TableSortBy::Runtime:
|
||||||
break;
|
if( m_findZone.selfTime )
|
||||||
case 2:
|
pdqsort_branchless( sortedZones.begin(), sortedZones.end(), [this]( const auto& lhs, const auto& rhs )
|
||||||
pdqsort_branchless( sortedZones.begin(), sortedZones.end(), [this]( const auto& lhs, const auto& rhs )
|
{
|
||||||
{
|
return (m_worker.GetZoneEndDirect( *lhs ) - lhs->start - GetZoneChildTimeFast( *lhs ))
|
||||||
if (lhs->name.active != rhs->name.active) return lhs->name.active > rhs->name.active;
|
>
|
||||||
|
(m_worker.GetZoneEndDirect( *rhs ) - rhs->start - GetZoneChildTimeFast( *rhs ));
|
||||||
|
} );
|
||||||
|
else
|
||||||
|
pdqsort_branchless( sortedZones.begin(), sortedZones.end(), [this]( const auto& lhs, const auto& rhs ) { return (m_worker.GetZoneEndDirect( *lhs ) - lhs->start) > (m_worker.GetZoneEndDirect( *rhs ) - rhs->start); } );
|
||||||
|
break;
|
||||||
|
case FindZone::TableSortBy::Name:
|
||||||
|
pdqsort_branchless( sortedZones.begin(), sortedZones.end(), [this]( const auto& lhs, const auto& rhs )
|
||||||
|
{
|
||||||
|
if (lhs->name.active != rhs->name.active) return lhs->name.active > rhs->name.active;
|
||||||
|
|
||||||
|
return strcmp(m_worker.GetString( lhs->name ), m_worker.GetString( rhs->name )) < 0;
|
||||||
|
} );
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
assert( false );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
return strcmp(m_worker.GetString( lhs->name ), m_worker.GetString( rhs->name )) < 0;
|
|
||||||
} );
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
assert( false );
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for( auto& ev : *zonesToIterate )
|
||||||
for( auto& ev : sortedZones )
|
|
||||||
{
|
{
|
||||||
const auto end = m_worker.GetZoneEndDirect( *ev );
|
const auto end = m_worker.GetZoneEndDirect( *ev );
|
||||||
auto timespan = end - ev->start;
|
auto timespan = end - ev->start;
|
||||||
|
|||||||
@ -267,7 +267,6 @@ private:
|
|||||||
bool m_goToFrame = false;
|
bool m_goToFrame = false;
|
||||||
|
|
||||||
int m_statSort = 0;
|
int m_statSort = 0;
|
||||||
int m_findZoneSort = 0;
|
|
||||||
bool m_statSelf = false;
|
bool m_statSelf = false;
|
||||||
bool m_showCallstackFrameAddress = false;
|
bool m_showCallstackFrameAddress = false;
|
||||||
bool m_showUnknownFrames = true;
|
bool m_showUnknownFrames = true;
|
||||||
@ -303,6 +302,7 @@ private:
|
|||||||
enum : uint64_t { Unselected = std::numeric_limits<uint64_t>::max() - 1 };
|
enum : uint64_t { Unselected = std::numeric_limits<uint64_t>::max() - 1 };
|
||||||
enum class GroupBy : int { Thread, UserText, Callstack };
|
enum class GroupBy : int { Thread, UserText, Callstack };
|
||||||
enum class SortBy : int { Order, Count, Time, Mtpc };
|
enum class SortBy : int { Order, Count, Time, Mtpc };
|
||||||
|
enum class TableSortBy : int { Starttime, Runtime, Name };
|
||||||
|
|
||||||
struct Group
|
struct Group
|
||||||
{
|
{
|
||||||
@ -324,6 +324,7 @@ private:
|
|||||||
bool selfTime = false;
|
bool selfTime = false;
|
||||||
GroupBy groupBy = GroupBy::Thread;
|
GroupBy groupBy = GroupBy::Thread;
|
||||||
SortBy sortBy = SortBy::Count;
|
SortBy sortBy = SortBy::Count;
|
||||||
|
TableSortBy tableSortBy = TableSortBy::Starttime;
|
||||||
Region highlight;
|
Region highlight;
|
||||||
int64_t hlOrig_t0, hlOrig_t1;
|
int64_t hlOrig_t0, hlOrig_t1;
|
||||||
int64_t numBins = -1;
|
int64_t numBins = -1;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user