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

Style fixes.

This commit is contained in:
Bartosz Taudul 2019-02-08 02:29:24 +01:00
parent 8fb6c0dfcb
commit 053932249c

View File

@ -5689,38 +5689,39 @@ void View::DrawFindZone()
Vector<ZoneEvent*>* zonesToIterate = &v->second.zones; Vector<ZoneEvent*>* zonesToIterate = &v->second.zones;
Vector<ZoneEvent*> sortedZones; Vector<ZoneEvent*> sortedZones;
if ( m_findZone.tableSortBy != FindZone::TableSortBy::Starttime ) if( m_findZone.tableSortBy != FindZone::TableSortBy::Starttime )
{ {
zonesToIterate = &sortedZones; zonesToIterate = &sortedZones;
sortedZones.reserve_and_use( v->second.zones.size() ); sortedZones.reserve_and_use( v->second.zones.size() );
memcpy(sortedZones.data(), v->second.zones.data(), sizeof(ZoneEvent*)*v->second.zones.size()); memcpy( sortedZones.data(), v->second.zones.data(), v->second.zones.size() * sizeof( ZoneEvent* ) );
switch( m_findZone.tableSortBy ) switch( m_findZone.tableSortBy )
{ {
case FindZone::TableSortBy::Runtime: case FindZone::TableSortBy::Runtime:
if( m_findZone.selfTime ) if( m_findZone.selfTime )
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 )) return m_worker.GetZoneEndDirect( *lhs ) - lhs->start - GetZoneChildTimeFast( *lhs ) >
> m_worker.GetZoneEndDirect( *rhs ) - rhs->start - GetZoneChildTimeFast( *rhs );
(m_worker.GetZoneEndDirect( *rhs ) - rhs->start - GetZoneChildTimeFast( *rhs )); } );
} ); }
else 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); } ); {
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; break;
case FindZone::TableSortBy::Name: case FindZone::TableSortBy::Name:
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 ) {
{ if( lhs->name.active != rhs->name.active ) return lhs->name.active > rhs->name.active;
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;
} );
return strcmp(m_worker.GetString( lhs->name ), m_worker.GetString( rhs->name )) < 0;
} );
break; break;
default: default:
assert( false ); assert( false );
break; break;
} }
} }
for( auto& ev : *zonesToIterate ) for( auto& ev : *zonesToIterate )