mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-30 01:04:36 +00:00
Store unique callstack payloads.
This commit is contained in:
parent
87467a472c
commit
c28465aa7c
@ -982,7 +982,7 @@ void Worker::DispatchProcess( const QueueItem& ev, char*& ptr )
|
||||
AddSourceLocationPayload( ev.stringTransfer.ptr, ptr, sz );
|
||||
break;
|
||||
case QueueType::CallstackPayload:
|
||||
//AddCallstackPayload( ev.stringTransfer.ptr, ptr, sz );
|
||||
AddCallstackPayload( ev.stringTransfer.ptr, ptr, sz );
|
||||
break;
|
||||
default:
|
||||
assert( false );
|
||||
@ -1265,6 +1265,36 @@ void Worker::AddCustomString( uint64_t ptr, char* str, size_t sz )
|
||||
m_pendingCustomStrings.emplace( ptr, StoreString( str, sz ) );
|
||||
}
|
||||
|
||||
void Worker::AddCallstackPayload( uint64_t ptr, char* _data, size_t sz )
|
||||
{
|
||||
assert( m_pendingCallstacks.find( ptr ) == m_pendingCallstacks.end() );
|
||||
|
||||
const auto memsize = sizeof( VarArray<uint64_t> ) + sz;
|
||||
auto mem = (char*)m_slab.AllocRaw( memsize );
|
||||
|
||||
auto data = (uint64_t*)mem;
|
||||
memcpy( data, _data, sz );
|
||||
|
||||
auto arr = (VarArray<uint64_t>*)( mem + sz );
|
||||
new(arr) VarArray<uint64_t>( sz / sizeof( uint64_t ), data );
|
||||
|
||||
uint32_t idx;
|
||||
auto it = m_data.callstackMap.find( arr );
|
||||
if( it == m_data.callstackMap.end() )
|
||||
{
|
||||
idx = m_data.callstackPayload.size();
|
||||
m_data.callstackMap.emplace( arr, idx );
|
||||
m_data.callstackPayload.push_back( arr );
|
||||
}
|
||||
else
|
||||
{
|
||||
idx = it->second;
|
||||
m_slab.Unalloc( memsize );
|
||||
}
|
||||
|
||||
m_pendingCallstacks.emplace( ptr, idx );
|
||||
}
|
||||
|
||||
void Worker::InsertPlot( PlotData* plot, int64_t time, double val )
|
||||
{
|
||||
if( plot->data.empty() )
|
||||
|
@ -17,6 +17,7 @@
|
||||
#include "tracy_flat_hash_map.hpp"
|
||||
#include "TracyEvent.hpp"
|
||||
#include "TracySlab.hpp"
|
||||
#include "TracyVarArray.hpp"
|
||||
|
||||
namespace tracy
|
||||
{
|
||||
@ -98,6 +99,9 @@ class Worker
|
||||
bool sourceLocationZonesReady;
|
||||
#endif
|
||||
|
||||
flat_hash_map<VarArray<uint64_t>*, uint32_t, VarArrayHasherPOT<uint64_t>, VarArrayComparator<uint64_t>> callstackMap;
|
||||
Vector<VarArray<uint64_t>*> callstackPayload;
|
||||
|
||||
std::map<uint32_t, LockMap> lockMap;
|
||||
|
||||
flat_hash_map<uint64_t, uint16_t, nohash<uint64_t>> threadMap;
|
||||
@ -243,6 +247,8 @@ private:
|
||||
void AddThreadString( uint64_t id, char* str, size_t sz );
|
||||
void AddCustomString( uint64_t ptr, char* str, size_t sz );
|
||||
|
||||
void AddCallstackPayload( uint64_t ptr, char* data, size_t sz );
|
||||
|
||||
void InsertPlot( PlotData* plot, int64_t time, double val );
|
||||
void HandlePlotName( uint64_t name, char* str, size_t sz );
|
||||
|
||||
@ -288,6 +294,7 @@ private:
|
||||
flat_hash_map<uint16_t, GpuCtxData*, nohash<uint16_t>> m_gpuCtxMap;
|
||||
flat_hash_map<uint64_t, StringLocation, nohash<uint64_t>> m_pendingCustomStrings;
|
||||
flat_hash_map<uint64_t, PlotData*, nohash<uint64_t>> m_pendingPlots;
|
||||
flat_hash_map<uint64_t, uint32_t> m_pendingCallstacks;
|
||||
flat_hash_map<uint64_t, PlotData*, nohash<uint64_t>> m_plotMap;
|
||||
flat_hash_map<const char*, PlotData*, charutil::HasherPOT, charutil::Comparator> m_plotRev;
|
||||
flat_hash_map<uint64_t, int32_t, nohash<uint64_t>> m_pendingSourceLocationPayload;
|
||||
|
Loading…
Reference in New Issue
Block a user