Add threads count to SrcLocZonesSlim.

This commit is contained in:
Bartosz Taudul 2023-12-20 17:06:28 +01:00
parent d01113150d
commit 8187519775
No known key found for this signature in database
GPG Key ID: B7FE2008B7575DF3
2 changed files with 24 additions and 14 deletions

View File

@ -89,6 +89,7 @@ class View
size_t sourceCount; size_t sourceCount;
size_t count; size_t count;
int64_t total; int64_t total;
uint16_t threadNum;
}; };
public: public:

View File

@ -11,6 +11,7 @@ extern double s_time;
struct SrcLocZonesSlim struct SrcLocZonesSlim
{ {
int16_t srcloc; int16_t srcloc;
uint16_t numThreads;
size_t numZones; size_t numZones;
int64_t total; int64_t total;
}; };
@ -118,11 +119,12 @@ void View::DrawStatistics()
if( cit->second.count != 0 ) if( cit->second.count != 0 )
{ {
slzcnt++; slzcnt++;
srcloc.push_back_no_space_check( SrcLocZonesSlim { it->first, cit->second.count, cit->second.total } ); srcloc.push_back_no_space_check( SrcLocZonesSlim { it->first, cit->second.threadNum, cit->second.count, cit->second.total } );
} }
} }
else else
{ {
unordered_flat_set<uint16_t> threads;
size_t cnt = 0; size_t cnt = 0;
int64_t total = 0; int64_t total = 0;
for( auto& v : it->second.zones ) for( auto& v : it->second.zones )
@ -137,20 +139,23 @@ void View::DrawStatistics()
{ {
total += zt - GetZoneChildTimeFast( z ); total += zt - GetZoneChildTimeFast( z );
cnt++; cnt++;
threads.emplace( v.Thread() );
} }
else if( m_statAccumulationMode == AccumulationMode::AllChildren || !IsZoneReentry( z ) ) else if( m_statAccumulationMode == AccumulationMode::AllChildren || !IsZoneReentry( z ) )
{ {
total += zt; total += zt;
cnt++; cnt++;
threads.emplace( v.Thread() );
} }
} }
} }
const auto threadNum = (uint16_t)threads.size();
if( cnt != 0 ) if( cnt != 0 )
{ {
slzcnt++; slzcnt++;
srcloc.push_back_no_space_check( SrcLocZonesSlim { it->first, cnt, total } ); srcloc.push_back_no_space_check( SrcLocZonesSlim { it->first, threadNum, cnt, total } );
} }
m_statCache[it->first] = StatisticsCache { RangeSlim { m_statRange.min, m_statRange.max, m_statRange.active }, m_statAccumulationMode, it->second.zones.size(), cnt, total }; m_statCache[it->first] = StatisticsCache { RangeSlim { m_statRange.min, m_statRange.max, m_statRange.active }, m_statAccumulationMode, it->second.zones.size(), cnt, total, threadNum };
} }
} }
else else
@ -165,11 +170,12 @@ void View::DrawStatistics()
{ {
if( cit->second.count != 0 ) if( cit->second.count != 0 )
{ {
srcloc.push_back_no_space_check( SrcLocZonesSlim { it->first, cit->second.count, cit->second.total } ); srcloc.push_back_no_space_check( SrcLocZonesSlim { it->first, cit->second.threadNum, cit->second.count, cit->second.total } );
} }
} }
else else
{ {
unordered_flat_set<uint16_t> threads;
size_t cnt = 0; size_t cnt = 0;
int64_t total = 0; int64_t total = 0;
for( auto& v : it->second.zones ) for( auto& v : it->second.zones )
@ -184,19 +190,22 @@ void View::DrawStatistics()
{ {
total += zt - GetZoneChildTimeFast( z ); total += zt - GetZoneChildTimeFast( z );
cnt++; cnt++;
threads.emplace( v.Thread() );
} }
else if( m_statAccumulationMode == AccumulationMode::AllChildren || !IsZoneReentry( z ) ) else if( m_statAccumulationMode == AccumulationMode::AllChildren || !IsZoneReentry( z ) )
{ {
total += zt; total += zt;
cnt++; cnt++;
threads.emplace( v.Thread() );
} }
} }
} }
const auto threadNum = (uint16_t)threads.size();
if( cnt != 0 ) if( cnt != 0 )
{ {
srcloc.push_back_no_space_check( SrcLocZonesSlim { it->first, cnt, total } ); srcloc.push_back_no_space_check( SrcLocZonesSlim { it->first, threadNum, cnt, total } );
} }
m_statCache[it->first] = StatisticsCache { RangeSlim { m_statRange.min, m_statRange.max, m_statRange.active }, m_statAccumulationMode, it->second.zones.size(), cnt, total }; m_statCache[it->first] = StatisticsCache { RangeSlim { m_statRange.min, m_statRange.max, m_statRange.active }, m_statAccumulationMode, it->second.zones.size(), cnt, total, threadNum };
} }
} }
} }
@ -229,7 +238,7 @@ void View::DrawStatistics()
} }
if( !filterActive ) if( !filterActive )
{ {
srcloc.push_back_no_space_check( SrcLocZonesSlim { it->first, count, total } ); srcloc.push_back_no_space_check( SrcLocZonesSlim { it->first, (uint16_t)it->second.threadCnt.size(), count, total } );
} }
else else
{ {
@ -237,7 +246,7 @@ void View::DrawStatistics()
auto name = m_worker.GetString( sl.name.active ? sl.name : sl.function ); auto name = m_worker.GetString( sl.name.active ? sl.name : sl.function );
if( m_statisticsFilter.PassFilter( name ) ) if( m_statisticsFilter.PassFilter( name ) )
{ {
srcloc.push_back_no_space_check( SrcLocZonesSlim { it->first, count, total } ); srcloc.push_back_no_space_check( SrcLocZonesSlim { it->first, (uint16_t)it->second.threadCnt.size(), count, total } );
} }
} }
} }
@ -331,7 +340,7 @@ void View::DrawStatistics()
if( cit->second.count != 0 ) if( cit->second.count != 0 )
{ {
slzcnt++; slzcnt++;
srcloc.push_back_no_space_check( SrcLocZonesSlim { it->first, cit->second.count, cit->second.total } ); srcloc.push_back_no_space_check( SrcLocZonesSlim { it->first, 0, cit->second.count, cit->second.total } );
} }
} }
else else
@ -353,7 +362,7 @@ void View::DrawStatistics()
if( cnt != 0 ) if( cnt != 0 )
{ {
slzcnt++; slzcnt++;
srcloc.push_back_no_space_check( SrcLocZonesSlim { it->first, cnt, total } ); srcloc.push_back_no_space_check( SrcLocZonesSlim { it->first, 0, cnt, total } );
} }
m_gpuStatCache[it->first] = StatisticsCache { RangeSlim { m_statRange.min, m_statRange.max, m_statRange.active }, m_statAccumulationMode, it->second.zones.size(), cnt, total }; m_gpuStatCache[it->first] = StatisticsCache { RangeSlim { m_statRange.min, m_statRange.max, m_statRange.active }, m_statAccumulationMode, it->second.zones.size(), cnt, total };
} }
@ -370,7 +379,7 @@ void View::DrawStatistics()
{ {
if( cit->second.count != 0 ) if( cit->second.count != 0 )
{ {
srcloc.push_back_no_space_check( SrcLocZonesSlim { it->first, cit->second.count, cit->second.total } ); srcloc.push_back_no_space_check( SrcLocZonesSlim { it->first, 0, cit->second.count, cit->second.total } );
} }
} }
else else
@ -391,7 +400,7 @@ void View::DrawStatistics()
} }
if( cnt != 0 ) if( cnt != 0 )
{ {
srcloc.push_back_no_space_check( SrcLocZonesSlim { it->first, cnt, total } ); srcloc.push_back_no_space_check( SrcLocZonesSlim { it->first, 0, cnt, total } );
} }
m_gpuStatCache[it->first] = StatisticsCache { RangeSlim { m_statRange.min, m_statRange.max, m_statRange.active }, m_statAccumulationMode, it->second.zones.size(), cnt, total }; m_gpuStatCache[it->first] = StatisticsCache { RangeSlim { m_statRange.min, m_statRange.max, m_statRange.active }, m_statAccumulationMode, it->second.zones.size(), cnt, total };
} }
@ -411,7 +420,7 @@ void View::DrawStatistics()
int64_t total = it->second.total; int64_t total = it->second.total;
if( !filterActive ) if( !filterActive )
{ {
srcloc.push_back_no_space_check( SrcLocZonesSlim { it->first, count, total } ); srcloc.push_back_no_space_check( SrcLocZonesSlim { it->first, 0, count, total } );
} }
else else
{ {
@ -419,7 +428,7 @@ void View::DrawStatistics()
auto name = m_worker.GetString( sl.name.active ? sl.name : sl.function ); auto name = m_worker.GetString( sl.name.active ? sl.name : sl.function );
if( m_statisticsFilter.PassFilter( name ) ) if( m_statisticsFilter.PassFilter( name ) )
{ {
srcloc.push_back_no_space_check( SrcLocZonesSlim { it->first, count, total } ); srcloc.push_back_no_space_check( SrcLocZonesSlim { it->first, 0, count, total } );
} }
} }
} }