Remove GPU context indirection.

This commit is contained in:
Bartosz Taudul 2017-11-21 02:10:41 +01:00
parent 63c070228c
commit d5ea8a86a4
2 changed files with 5 additions and 6 deletions

View File

@ -835,8 +835,6 @@ void View::ProcessMessageLiteral( const QueueMessage& ev )
void View::ProcessGpuNewContext( const QueueGpuNewContext& ev ) void View::ProcessGpuNewContext( const QueueGpuNewContext& ev )
{ {
assert( m_gpuCtxMap.find( ev.context ) == m_gpuCtxMap.end() ); assert( m_gpuCtxMap.find( ev.context ) == m_gpuCtxMap.end() );
const auto idx = m_gpuData.size();
m_gpuCtxMap.emplace( ev.context, idx );
auto gpu = m_slab.AllocInit<GpuCtxData>(); auto gpu = m_slab.AllocInit<GpuCtxData>();
gpu->timeDiff = int64_t( ev.cputime * m_timerMul - ev.gputime ); gpu->timeDiff = int64_t( ev.cputime * m_timerMul - ev.gputime );
@ -845,13 +843,14 @@ void View::ProcessGpuNewContext( const QueueGpuNewContext& ev )
gpu->count = 0; gpu->count = 0;
gpu->showFull = true; gpu->showFull = true;
m_gpuData.push_back( gpu ); m_gpuData.push_back( gpu );
m_gpuCtxMap.emplace( ev.context, gpu );
} }
void View::ProcessGpuZoneBegin( const QueueGpuZoneBegin& ev ) void View::ProcessGpuZoneBegin( const QueueGpuZoneBegin& ev )
{ {
auto it = m_gpuCtxMap.find( ev.context ); auto it = m_gpuCtxMap.find( ev.context );
assert( it != m_gpuCtxMap.end() ); assert( it != m_gpuCtxMap.end() );
auto ctx = m_gpuData[it->second]; auto ctx = it->second;
CheckSourceLocation( ev.srcloc ); CheckSourceLocation( ev.srcloc );
@ -879,7 +878,7 @@ void View::ProcessGpuZoneEnd( const QueueGpuZoneEnd& ev )
{ {
auto it = m_gpuCtxMap.find( ev.context ); auto it = m_gpuCtxMap.find( ev.context );
assert( it != m_gpuCtxMap.end() ); assert( it != m_gpuCtxMap.end() );
auto ctx = m_gpuData[it->second]; auto ctx = it->second;
assert( !ctx->stack.empty() ); assert( !ctx->stack.empty() );
auto zone = ctx->stack.back_and_pop(); auto zone = ctx->stack.back_and_pop();
@ -892,7 +891,7 @@ void View::ProcessGpuTime( const QueueGpuTime& ev )
{ {
auto it = m_gpuCtxMap.find( ev.context ); auto it = m_gpuCtxMap.find( ev.context );
assert( it != m_gpuCtxMap.end() ); assert( it != m_gpuCtxMap.end() );
auto ctx = m_gpuData[it->second]; auto ctx = it->second;
auto zone = ctx->queue.front(); auto zone = ctx->queue.front();
if( zone->gpuStart == std::numeric_limits<int64_t>::max() ) if( zone->gpuStart == std::numeric_limits<int64_t>::max() )

View File

@ -191,7 +191,7 @@ private:
flat_hash_set<uint64_t, power_of_two_std_hash<uint64_t>> m_pendingSourceLocation; flat_hash_set<uint64_t, power_of_two_std_hash<uint64_t>> m_pendingSourceLocation;
flat_hash_map<uint64_t, StringLocation, power_of_two_std_hash<uint64_t>> m_pendingCustomStrings; flat_hash_map<uint64_t, StringLocation, power_of_two_std_hash<uint64_t>> m_pendingCustomStrings;
flat_hash_map<uint64_t, ThreadData*, power_of_two_std_hash<uint64_t>> m_threadMap; flat_hash_map<uint64_t, ThreadData*, power_of_two_std_hash<uint64_t>> m_threadMap;
flat_hash_map<uint16_t, uint32_t, power_of_two_std_hash<uint16_t>> m_gpuCtxMap; flat_hash_map<uint16_t, GpuCtxData*, power_of_two_std_hash<uint16_t>> m_gpuCtxMap;
flat_hash_map<uint64_t, PlotData*, power_of_two_std_hash<uint64_t>> m_plotMap; flat_hash_map<uint64_t, PlotData*, power_of_two_std_hash<uint64_t>> m_plotMap;
std::unordered_map<const char*, PlotData*, charutil::Hasher, charutil::Comparator> m_plotRev; std::unordered_map<const char*, PlotData*, charutil::Hasher, charutil::Comparator> m_plotRev;
flat_hash_map<uint64_t, PlotData*, power_of_two_std_hash<uint64_t>> m_pendingPlots; flat_hash_map<uint64_t, PlotData*, power_of_two_std_hash<uint64_t>> m_pendingPlots;