Create GPU source location zones stats entry, if not present.

In case of CPU statistics data, this entry is created during creation of a
source location. This won't be done for GPU zones, as it would needlessly
expand the number of held entries. This is assuming the number of GPU zones
is significantly less than the number of CPU zones.
This commit is contained in:
Bartosz Taudul 2022-01-29 15:45:25 +01:00
parent 32173dca29
commit df96293477
No known key found for this signature in database
GPG Key ID: B7FE2008B7575DF3

View File

@ -3786,7 +3786,10 @@ Worker::SourceLocationZones* Worker::GetSourceLocationZonesReal( uint16_t srcloc
Worker::GpuSourceLocationZones* Worker::GetGpuSourceLocationZonesReal( uint16_t srcloc ) Worker::GpuSourceLocationZones* Worker::GetGpuSourceLocationZonesReal( uint16_t srcloc )
{ {
auto it = m_data.gpuSourceLocationZones.find( srcloc ); auto it = m_data.gpuSourceLocationZones.find( srcloc );
assert( it != m_data.gpuSourceLocationZones.end() ); if( it == m_data.gpuSourceLocationZones.end() )
{
it = m_data.gpuSourceLocationZones.emplace( srcloc, GpuSourceLocationZones() ).first;
}
m_data.gpuZonesLast.first = srcloc; m_data.gpuZonesLast.first = srcloc;
m_data.gpuZonesLast.second = &it->second; m_data.gpuZonesLast.second = &it->second;
return &it->second; return &it->second;