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

Pack ZoneThreadData.

This reduces struct size from 10 to 8 bytes. Assumes 48-bit pointers
(4-level paging)!

Memory savings (MB):

android     2766    ->  2757    (99%)
big         10.29 G ->  9902    (96%)
chicken     2244    ->  2172    (96%)
ctx-android 228     ->  224     (98%)
drl-l-b     1635    ->  1570    (96%)
gn-vulkan   244     ->  240     (98%)
long        5656    ->  5496    (97%)
q3bsp-mt    6043    ->  5784    (95%)
selfprofile 1554    ->  1486    (95%)
This commit is contained in:
Bartosz Taudul
2019-08-31 00:55:51 +02:00
parent 3ec534cdf3
commit 86cb477811
3 changed files with 37 additions and 29 deletions
+7 -5
View File
@@ -1528,9 +1528,9 @@ Worker::Worker( FileRead& f, EventType::Type eventMask )
{
auto& zones = v.second.zones;
#ifdef MY_LIBCPP_SUCKS
pdqsort_branchless( zones.begin(), zones.end(), []( const auto& lhs, const auto& rhs ) { return lhs.zone->Start() < rhs.zone->Start(); } );
pdqsort_branchless( zones.begin(), zones.end(), []( const auto& lhs, const auto& rhs ) { return lhs.Zone()->Start() < rhs.Zone()->Start(); } );
#else
std::sort( std::execution::par_unseq, zones.begin(), zones.end(), []( const auto& lhs, const auto& rhs ) { return lhs.zone->Start() < rhs.zone->Start(); } );
std::sort( std::execution::par_unseq, zones.begin(), zones.end(), []( const auto& lhs, const auto& rhs ) { return lhs.Zone()->Start() < rhs.Zone()->Start(); } );
#endif
}
{
@@ -2440,7 +2440,9 @@ void Worker::NewZone( ZoneEvent* zone, uint64_t thread )
#ifndef TRACY_NO_STATISTICS
auto it = m_data.sourceLocationZones.find( zone->SrcLoc() );
assert( it != m_data.sourceLocationZones.end() );
it->second.zones.push_back( ZoneThreadData { zone, CompressThread( thread ) } );
auto& ztd = it->second.zones.push_next();
ztd.SetZone( zone );
ztd.SetThread( CompressThread( thread ) );
#else
auto it = m_data.sourceLocationZonesCnt.find( zone->SrcLoc() );
assert( it != m_data.sourceLocationZonesCnt.end() );
@@ -4457,8 +4459,8 @@ void Worker::ReadTimelineUpdateStatistics( ZoneEvent* zone, uint16_t thread )
assert( it != m_data.sourceLocationZones.end() );
auto& slz = it->second;
auto& ztd = slz.zones.push_next();
ztd.zone = zone;
ztd.thread = thread;
ztd.SetZone( zone );
ztd.SetThread( thread );
if( zone->end >= 0 )
{