Don't send source location pointer in query reply.

Since reply order is the same as the query order, the server already
knows what source location it receives. This observation allows placing
zone name into the source location struct.
This commit is contained in:
Bartosz Taudul 2017-11-14 23:06:45 +01:00
parent e0b5c25f87
commit c43eb29ce0
11 changed files with 87 additions and 115 deletions

View File

@ -58,9 +58,7 @@ To begin data collection, tracy requires that you manually instrument your appli
To slice the program's execution recording into frame-sized chunks, put the `FrameMark` macro after you have completed rendering the frame. Ideally that would be right after the swap buffers command. Note that this step is optional, as some applications (for example: a compression utility) do not have the concept of a frame.
To record a zone's execution time add the `ZoneScoped` macro at the beginning of the scope you want to measure. This will automatically record function name, source file name and location. Optionally you may use the `ZoneScopedC( 0xRRGGBB )` macro to set a custom color for the zone. Note that the color value will be constant in the recording (don't try to parametrize it). After you have marked the zone, you may further parametrize it.
Use the `ZoneName( const char* name )` macro to set a custom name for the zone, which will be displayed instead of the function's name in the timeline view. The indented usage is to provide a string literal. (The text string that you provide **must** be accessible indefinitely at the given address. Tracy does not guarantee at which point in time it will be sent to the server and there is no notification when it happens.)
To record a zone's execution time add the `ZoneScoped` macro at the beginning of the scope you want to measure. This will automatically record function name, source file name and location. Optionally you may use the `ZoneScopedC( 0xRRGGBB )` macro to set a custom color for the zone. Note that the color value will be constant in the recording (don't try to parametrize it). You may also set a custom name for the zone, using the `ZoneScopedN( name )` macro, where name is a string literal. Color and name may be combined by using the `ZoneScopedNC( name, color )` macro.
Use the `ZoneText( const char* text, size_t size )` macro to add a custom text string that will be displayed along the zone information (for example, name of the file you are opening). Note that every time `ZoneText` is invoked, a memory allocation is performed to store an internal copy of the data. The provided string is not used by tracy after ZoneText returns.
@ -96,7 +94,7 @@ Alternatively, you may want to embed the server in your application, the same wh
#### Lua support
To profile Lua code using tracy, include the `tracy/TracyLua.hpp` header file in your Lua wrapper and execute `tracy::LuaRegister( lua_State* )` function to add instrumentation support. In your Lua code, add `tracy.ZoneBegin()` and `tracy.ZoneEnd()` calls to mark execution zones. Double check if you have included all return paths! Use `tracy.ZoneText( text )` to set zone text. Use `tracy.ZoneName( name )` to set zone name. Use `tracy.Message( text )` to send messages.
To profile Lua code using tracy, include the `tracy/TracyLua.hpp` header file in your Lua wrapper and execute `tracy::LuaRegister( lua_State* )` function to add instrumentation support. In your Lua code, add `tracy.ZoneBegin()` and `tracy.ZoneEnd()` calls to mark execution zones. Double check if you have included all return paths! Use `tracy.ZoneBeginN( name )` to set zone name. Use `tracy.ZoneText( text )` to set zone text. Use `tracy.Message( text )` to send messages.
Even if tracy is disabled, you still have to pay the no-op function call cost. To prevent that you may want to use the `tracy::LuaRemove( char* script )` function, which will replace instrumentation calls with whitespace. This function does nothing if profiler is enabled.

View File

@ -6,7 +6,9 @@
#ifndef TRACY_ENABLE
#define ZoneScoped
#define ZoneScopedN(x)
#define ZoneScopedC(x)
#define ZoneScopedNC(x,y)
#define ZoneText(x,y)
#define ZoneName(x)
@ -29,18 +31,19 @@
#include "client/TracyProfiler.hpp"
#include "client/TracyScoped.hpp"
#define ZoneScoped static const tracy::SourceLocation __tracy_source_location { __FUNCTION__, __FILE__, (uint32_t)__LINE__, 0 }; tracy::ScopedZone ___tracy_scoped_zone( &__tracy_source_location );
#define ZoneScopedC( color ) static const tracy::SourceLocation __tracy_source_location { __FUNCTION__, __FILE__, (uint32_t)__LINE__, color }; tracy::ScopedZone ___tracy_scoped_zone( &__tracy_source_location );
#define ZoneScoped static const tracy::SourceLocation __tracy_source_location { nullptr, __FUNCTION__, __FILE__, (uint32_t)__LINE__, 0 }; tracy::ScopedZone ___tracy_scoped_zone( &__tracy_source_location );
#define ZoneScopedN( name ) static const tracy::SourceLocation __tracy_source_location { name, __FUNCTION__, __FILE__, (uint32_t)__LINE__, 0 }; tracy::ScopedZone ___tracy_scoped_zone( &__tracy_source_location );
#define ZoneScopedC( color ) static const tracy::SourceLocation __tracy_source_location { nullptr, __FUNCTION__, __FILE__, (uint32_t)__LINE__, color }; tracy::ScopedZone ___tracy_scoped_zone( &__tracy_source_location );
#define ZoneScopedNC( name, color ) static const tracy::SourceLocation __tracy_source_location { name, __FUNCTION__, __FILE__, (uint32_t)__LINE__, color }; tracy::ScopedZone ___tracy_scoped_zone( &__tracy_source_location );
#define ZoneText( txt, size ) ___tracy_scoped_zone.Text( txt, size );
#define ZoneName( name ) ___tracy_scoped_zone.Name( name );
#define FrameMark tracy::Profiler::FrameMark();
#define TracyLockable( type, varname ) tracy::Lockable<type> varname { [] () -> const tracy::SourceLocation* { static const tracy::SourceLocation srcloc { #type " " #varname, __FILE__, __LINE__, 0 }; return &srcloc; }() };
#define TracyLockableN( type, varname, desc ) tracy::Lockable<type> varname { [] () -> const tracy::SourceLocation* { static const tracy::SourceLocation srcloc { desc, __FILE__, __LINE__, 0 }; return &srcloc; }() };
#define TracyLockable( type, varname ) tracy::Lockable<type> varname { [] () -> const tracy::SourceLocation* { static const tracy::SourceLocation srcloc { nullptr, #type " " #varname, __FILE__, __LINE__, 0 }; return &srcloc; }() };
#define TracyLockableN( type, varname, desc ) tracy::Lockable<type> varname { [] () -> const tracy::SourceLocation* { static const tracy::SourceLocation srcloc { nullptr, desc, __FILE__, __LINE__, 0 }; return &srcloc; }() };
#define LockableBase( type ) tracy::Lockable<type>
#define LockMark( varname ) static const tracy::SourceLocation __tracy_lock_location_##varname { __FUNCTION__, __FILE__, (uint32_t)__LINE__, 0 }; varname.Mark( &__tracy_lock_location_##varname );
#define LockMark( varname ) static const tracy::SourceLocation __tracy_lock_location_##varname { nullptr, __FUNCTION__, __FILE__, (uint32_t)__LINE__, 0 }; varname.Mark( &__tracy_lock_location_##varname );
#define TracyPlot( name, val ) tracy::Profiler::PlotData( name, val );

View File

@ -21,12 +21,12 @@ static inline void LuaRegister( lua_State* L )
lua_pushcfunction( L, detail::noop );
lua_setfield( L, -2, "ZoneBegin" );
lua_pushcfunction( L, detail::noop );
lua_setfield( L, -2, "ZoneBeginN" );
lua_pushcfunction( L, detail::noop );
lua_setfield( L, -2, "ZoneEnd" );
lua_pushcfunction( L, detail::noop );
lua_setfield( L, -2, "ZoneText" );
lua_pushcfunction( L, detail::noop );
lua_setfield( L, -2, "ZoneName" );
lua_pushcfunction( L, detail::noop );
lua_setfield( L, -2, "Message" );
lua_setglobal( L, "tracy" );
}
@ -67,6 +67,12 @@ static inline void LuaRemove( char* script )
memset( script, ' ', end - script );
script = end;
}
else if( strcmp( script + 10, "BeginN(", 7 ) == 0 )
{
auto end = FindEnd( script + 17 );
memset( script, ' ', end - script );
script = end;
}
else
{
script += 10;
@ -143,6 +149,46 @@ static inline int LuaZoneBegin( lua_State* L )
return 0;
}
static inline int LuaZoneBeginN( lua_State* L )
{
const uint32_t color = 0x00CC8855;
lua_Debug dbg;
lua_getstack( L, 1, &dbg );
lua_getinfo( L, "Snl", &dbg );
const uint32_t line = dbg.currentline;
const auto name = dbg.name ? dbg.name : dbg.short_src;
const auto fsz = strlen( name );
const auto ssz = strlen( dbg.source );
// Data layout:
// 4b payload size
// 4b color
// 4b source line
// fsz function name
// 1b null terminator
// ssz source file name
const uint32_t sz = 4 + 4 + 4 + fsz + 1 + ssz;
auto ptr = (char*)tracy_malloc( sz );
memcpy( ptr, &sz, 4 );
memcpy( ptr + 4, &color, 4 );
memcpy( ptr + 8, &line, 4 );
memcpy( ptr + 12, name, fsz+1 );
memcpy( ptr + 12 + fsz + 1, dbg.source, ssz );
Magic magic;
auto& token = s_token.ptr;
auto& tail = token->get_tail_index();
auto item = token->enqueue_begin<moodycamel::CanAlloc>( magic );
item->hdr.type = QueueType::ZoneBeginAllocSrcLoc;
item->zoneBegin.time = Profiler::GetTime( item->zoneBegin.cpu );
item->zoneBegin.thread = GetThreadHandle();
item->zoneBegin.srcloc = (uint64_t)ptr;
tail.store( magic + 1, std::memory_order_release );
return 0;
}
static inline int LuaZoneEnd( lua_State* L )
{
Magic magic;
@ -175,25 +221,6 @@ static inline int LuaZoneText( lua_State* L )
return 0;
}
static inline int LuaZoneName( lua_State* L )
{
auto txt = lua_tostring( L, 1 );
const auto size = strlen( txt );
Magic magic;
auto& token = s_token.ptr;
auto ptr = (char*)tracy_malloc( size+1 );
memcpy( ptr, txt, size );
ptr[size] = '\0';
auto& tail = token->get_tail_index();
auto item = token->enqueue_begin<moodycamel::CanAlloc>( magic );
item->hdr.type = QueueType::ZoneNameLiteral;
item->zoneName.thread = GetThreadHandle();
item->zoneName.name = (uint64_t)ptr;
tail.store( magic + 1, std::memory_order_release );
return 0;
}
static inline int LuaMessage( lua_State* L )
{
auto txt = lua_tostring( L, 1 );
@ -221,12 +248,12 @@ static inline void LuaRegister( lua_State* L )
lua_newtable( L );
lua_pushcfunction( L, detail::LuaZoneBegin );
lua_setfield( L, -2, "ZoneBegin" );
lua_pushcfunction( L, detail::LuaZoneBegin );
lua_setfield( L, -2, "ZoneBeginN" );
lua_pushcfunction( L, detail::LuaZoneEnd );
lua_setfield( L, -2, "ZoneEnd" );
lua_pushcfunction( L, detail::LuaZoneText );
lua_setfield( L, -2, "ZoneText" );
lua_pushcfunction( L, detail::LuaZoneName );
lua_setfield( L, -2, "ZoneName" );
lua_pushcfunction( L, detail::LuaMessage );
lua_setfield( L, -2, "Message" );
lua_setglobal( L, "tracy" );

View File

@ -31,8 +31,8 @@ public:
#include "common/TracyAlloc.hpp"
#define TracyGpuContext tracy::s_gpuCtx = (tracy::GpuCtx*)tracy::tracy_malloc( sizeof( tracy::GpuCtx ) ); new(tracy::s_gpuCtx) tracy::GpuCtx;
#define TracyGpuZone( name ) static const tracy::SourceLocation __tracy_gpu_source_location { __FUNCTION__, __FILE__, (uint32_t)__LINE__, 0 }; tracy::GpuCtxScope ___tracy_gpu_zone( name, &__tracy_gpu_source_location );
#define TracyGpuZoneC( name, color ) static const tracy::SourceLocation __tracy_gpu_source_location { __FUNCTION__, __FILE__, (uint32_t)__LINE__, color }; tracy::GpuCtxScope ___tracy_gpu_zone( name, &__tracy_gpu_source_location );
#define TracyGpuZone( name ) static const tracy::SourceLocation __tracy_gpu_source_location { name, __FUNCTION__, __FILE__, (uint32_t)__LINE__, 0 }; tracy::GpuCtxScope ___tracy_gpu_zone( &__tracy_gpu_source_location );
#define TracyGpuZoneC( name, color ) static const tracy::SourceLocation __tracy_gpu_source_location { name, __FUNCTION__, __FILE__, (uint32_t)__LINE__, color }; tracy::GpuCtxScope ___tracy_gpu_zone( &__tracy_gpu_source_location );
#define TracyGpuCollect tracy::s_gpuCtx->Collect();
namespace tracy
@ -138,7 +138,7 @@ extern thread_local GpuCtx* s_gpuCtx;
class GpuCtxScope
{
public:
tracy_force_inline GpuCtxScope( const char* name, const SourceLocation* srcloc )
tracy_force_inline GpuCtxScope( const SourceLocation* srcloc )
{
glQueryCounter( s_gpuCtx->NextQueryId(), GL_TIMESTAMP );
@ -148,7 +148,6 @@ public:
auto item = token->enqueue_begin<moodycamel::CanAlloc>( magic );
item->hdr.type = QueueType::GpuZoneBegin;
item->gpuZoneBegin.cpuTime = Profiler::GetTime();
item->gpuZoneBegin.name = (uint64_t)name;
item->gpuZoneBegin.srcloc = (uint64_t)srcloc;
item->gpuZoneBegin.context = s_gpuCtx->GetId();
tail.store( magic + 1, std::memory_order_release );

View File

@ -276,11 +276,6 @@ Profiler::DequeueStatus Profiler::Dequeue( moodycamel::ConsumerToken& token )
SendString( ptr, (const char*)ptr, QueueType::CustomStringData );
tracy_free( (void*)ptr );
break;
case QueueType::ZoneNameLiteral:
ptr = item->zoneName.name;
SendString( ptr, (const char*)ptr, QueueType::CustomStringData );
tracy_free( (void*)ptr );
break;
case QueueType::Message:
ptr = item->message.text;
SendString( ptr, (const char*)ptr, QueueType::CustomStringData );
@ -364,7 +359,7 @@ void Profiler::SendSourceLocation( uint64_t ptr )
auto srcloc = (const SourceLocation*)ptr;
QueueItem item;
item.hdr.type = QueueType::SourceLocation;
item.srcloc.ptr = ptr;
item.srcloc.name = (uint64_t)srcloc->name;
item.srcloc.file = (uint64_t)srcloc->file;
item.srcloc.function = (uint64_t)srcloc->function;
item.srcloc.line = srcloc->line;
@ -484,7 +479,7 @@ void Profiler::CalibrateDelay()
moodycamel::ConcurrentQueue<QueueItem>::ExplicitProducer* ptoken = s_queue.get_explicit_producer( ptoken_detail );
for( int i=0; i<Iterations; i++ )
{
static const tracy::SourceLocation __tracy_source_location { __FUNCTION__, __FILE__, (uint32_t)__LINE__, 0 };
static const tracy::SourceLocation __tracy_source_location { nullptr, __FUNCTION__, __FILE__, (uint32_t)__LINE__, 0 };
{
Magic magic;
auto& tail = ptoken->get_tail_index();
@ -508,13 +503,13 @@ void Profiler::CalibrateDelay()
const auto f0 = GetTime();
for( int i=0; i<Iterations; i++ )
{
static const tracy::SourceLocation __tracy_source_location { __FUNCTION__, __FILE__, (uint32_t)__LINE__, 0 };
static const tracy::SourceLocation __tracy_source_location { nullptr, __FUNCTION__, __FILE__, (uint32_t)__LINE__, 0 };
FakeZone ___tracy_scoped_zone( &__tracy_source_location );
}
const auto t0 = GetTime();
for( int i=0; i<Iterations; i++ )
{
static const tracy::SourceLocation __tracy_source_location { __FUNCTION__, __FILE__, (uint32_t)__LINE__, 0 };
static const tracy::SourceLocation __tracy_source_location { nullptr, __FUNCTION__, __FILE__, (uint32_t)__LINE__, 0 };
{
Magic magic;
auto& tail = ptoken->get_tail_index();

View File

@ -27,6 +27,7 @@ class Socket;
struct SourceLocation
{
const char* name;
const char* function;
const char* file;
uint32_t line;

View File

@ -56,18 +56,6 @@ public:
tail.store( magic + 1, std::memory_order_release );
}
tracy_force_inline void Name( const char* name )
{
Magic magic;
auto& token = s_token.ptr;
auto& tail = token->get_tail_index();
auto item = token->enqueue_begin<moodycamel::CanAlloc>( magic );
item->hdr.type = QueueType::ZoneName;
item->zoneName.thread = m_thread;
item->zoneName.name = (uint64_t)name;
tail.store( magic + 1, std::memory_order_release );
}
private:
uint64_t m_thread;
};

View File

@ -19,8 +19,6 @@ enum class QueueType : uint8_t
SourceLocation,
SourceLocationPayload,
ZoneText,
ZoneName,
ZoneNameLiteral,
LockWait,
LockObtain,
LockRelease,
@ -65,7 +63,7 @@ struct QueueFrameMark
struct QueueSourceLocation
{
uint64_t ptr;
uint64_t name;
uint64_t function; // ptr
uint64_t file; // ptr
uint32_t line;
@ -80,12 +78,6 @@ struct QueueZoneText
uint64_t text; // ptr
};
struct QueueZoneName
{
uint64_t thread;
uint64_t name; // ptr
};
struct QueueLockWait
{
uint32_t id;
@ -153,7 +145,6 @@ struct QueueGpuNewContext
struct QueueGpuZoneBegin
{
int64_t cpuTime;
uint64_t name;
uint64_t srcloc;
uint16_t context;
};
@ -190,7 +181,6 @@ struct QueueItem
QueueFrameMark frameMark;
QueueSourceLocation srcloc;
QueueZoneText zoneText;
QueueZoneName zoneName;
QueueLockWait lockWait;
QueueLockObtain lockObtain;
QueueLockRelease lockRelease;
@ -220,8 +210,6 @@ static const size_t QueueDataSize[] = {
sizeof( QueueHeader ) + sizeof( QueueSourceLocation ),
sizeof( QueueHeader ) + sizeof( QueueStringTransfer ), // allocated source location payload
sizeof( QueueHeader ) + sizeof( QueueZoneText ),
sizeof( QueueHeader ) + sizeof( QueueZoneName ),
sizeof( QueueHeader ) + sizeof( QueueZoneName ), // literal
sizeof( QueueHeader ) + sizeof( QueueLockWait ),
sizeof( QueueHeader ) + sizeof( QueueLockObtain ),
sizeof( QueueHeader ) + sizeof( QueueLockRelease ),

View File

@ -47,6 +47,7 @@ struct TextData
struct SourceLocation
{
StringRef name;
StringRef function;
StringRef file;
uint32_t line;
@ -102,7 +103,6 @@ struct GpuEvent
int64_t gpuStart;
int64_t gpuEnd;
int32_t srcloc;
uint64_t name;
Vector<GpuEvent*> child;
};

View File

@ -582,12 +582,6 @@ void View::Process( const QueueItem& ev )
case QueueType::ZoneText:
ProcessZoneText( ev.zoneText );
break;
case QueueType::ZoneName:
ProcessZoneName( ev.zoneName );
break;
case QueueType::ZoneNameLiteral:
ProcessZoneNameLiteral( ev.zoneName );
break;
case QueueType::LockWait:
ProcessLockWait( ev.lockWait );
break;
@ -711,29 +705,6 @@ void View::ProcessZoneText( const QueueZoneText& ev )
m_pendingCustomStrings.erase( it );
}
void View::ProcessZoneName( const QueueZoneName& ev )
{
auto& stack = m_zoneStack[ev.thread];
assert( !stack.empty() );
auto zone = stack.back();
CheckString( ev.name );
std::lock_guard<std::mutex> lock( m_lock );
GetTextData( *zone )->zoneName = StringRef( StringRef::Ptr, ev.name );
}
void View::ProcessZoneNameLiteral( const QueueZoneName& ev )
{
auto& stack = m_zoneStack[ev.thread];
assert( !stack.empty() );
auto zone = stack.back();
auto it = m_pendingCustomStrings.find( ev.name );
assert( it != m_pendingCustomStrings.end() );
m_lock.lock();
GetTextData( *zone )->zoneName = StringRef( StringRef::Idx, it->second.idx );
m_lock.unlock();
m_pendingCustomStrings.erase( it );
}
void View::ProcessLockWait( const QueueLockWait& ev )
{
auto lev = m_slab.Alloc<LockEvent>();
@ -893,7 +864,6 @@ void View::ProcessGpuZoneBegin( const QueueGpuZoneBegin& ev )
assert( m_gpuData.size() >= ev.context );
auto ctx = m_gpuData[ev.context];
CheckString( ev.name );
CheckSourceLocation( ev.srcloc );
auto zone = m_slab.AllocInit<GpuEvent>();
@ -901,7 +871,6 @@ void View::ProcessGpuZoneBegin( const QueueGpuZoneBegin& ev )
zone->cpuEnd = -1;
zone->gpuStart = std::numeric_limits<int64_t>::max();
zone->gpuEnd = -1;
zone->name = ev.name;
zone->srcloc = ShrinkSourceLocation( ev.srcloc );
auto timeline = &ctx->timeline;
@ -954,6 +923,7 @@ void View::ProcessGpuTime( const QueueGpuTime& ev )
void View::CheckString( uint64_t ptr )
{
if( ptr == 0 ) return;
if( m_strings.find( ptr ) != m_strings.end() ) return;
if( m_pendingStrings.find( ptr ) != m_pendingStrings.end() ) return;
@ -978,6 +948,7 @@ void View::CheckSourceLocation( uint64_t ptr )
if( m_pendingSourceLocation.find( ptr ) != m_pendingSourceLocation.end() ) return;
m_pendingSourceLocation.emplace( ptr );
m_sourceLocationQueue.push_back( ptr );
ServerQuery( ServerQuerySourceLocation, ptr );
}
@ -1037,15 +1008,19 @@ StringLocation View::StoreString( char* str, size_t sz )
void View::AddSourceLocation( const QueueSourceLocation& srcloc )
{
assert( m_sourceLocation.find( srcloc.ptr ) == m_sourceLocation.end() );
auto it = m_pendingSourceLocation.find( srcloc.ptr );
const auto ptr = m_sourceLocationQueue.front();
m_sourceLocationQueue.erase( m_sourceLocationQueue.begin() );
assert( m_sourceLocation.find( ptr ) == m_sourceLocation.end() );
auto it = m_pendingSourceLocation.find( ptr );
assert( it != m_pendingSourceLocation.end() );
m_pendingSourceLocation.erase( it );
CheckString( srcloc.name );
CheckString( srcloc.file );
CheckString( srcloc.function );
uint32_t color = ( srcloc.r << 16 ) | ( srcloc.g << 8 ) | srcloc.b;
std::lock_guard<std::mutex> lock( m_lock );
m_sourceLocation.emplace( srcloc.ptr, SourceLocation { StringRef( StringRef::Ptr, srcloc.function ), StringRef( StringRef::Ptr, srcloc.file ), srcloc.line, color } );
m_sourceLocation.emplace( ptr, SourceLocation { StringRef( StringRef::Ptr, srcloc.name ), StringRef( StringRef::Ptr, srcloc.function ), StringRef( StringRef::Ptr, srcloc.file ), srcloc.line, color } );
}
void View::AddSourceLocationPayload( uint64_t ptr, char* data, size_t sz )
@ -1066,7 +1041,7 @@ void View::AddSourceLocationPayload( uint64_t ptr, char* data, size_t sz )
const auto ssz = sz - ( end - start );
const auto source = StoreString( end, ssz );
SourceLocation srcloc { StringRef( StringRef::Idx, func.idx ), StringRef( StringRef::Idx, source.idx ), line, color };
SourceLocation srcloc { StringRef( StringRef::Ptr, 0 ), StringRef( StringRef::Idx, func.idx ), StringRef( StringRef::Idx, source.idx ), line, color };
auto it = m_sourceLocationPayloadMap.find( &srcloc );
if( it == m_sourceLocationPayloadMap.end() )
{
@ -2503,7 +2478,7 @@ int View::DrawGpuZoneLevel( const Vector<GpuEvent*>& vec, bool hover, double pxn
if( d > maxdepth ) maxdepth = d;
}
const char* zoneName = GetString( ev.name );
const char* zoneName = GetString( srcloc.name );
auto tsz = ImGui::CalcTextSize( zoneName );
const auto pr0 = ( ev.gpuStart - m_zvStart ) * pxns;
@ -3351,8 +3326,8 @@ void View::DrawGpuInfoWindow()
ImGui::Separator();
ImGui::Text( "Zone name: %s", GetString( ev.name ) );
auto& srcloc = GetSourceLocation( ev.srcloc );
ImGui::Text( "Zone name: %s", GetString( srcloc.name ) );
ImGui::Text( "Function: %s", GetString( srcloc.function ) );
ImGui::Text( "Location: %s:%i", GetString( srcloc.file ), srcloc.line );
@ -3392,7 +3367,8 @@ void View::DrawGpuInfoWindow()
for( size_t i=0; i<ev.child.size(); i++ )
{
auto& cev = *ev.child[cti[i]];
ImGui::Text( "%s", GetString( cev.name ) );
auto& csl = GetSourceLocation( cev.srcloc );
ImGui::Text( "%s", GetString( csl.name ) );
if( ImGui::IsItemHovered() )
{
m_gpuHighlight = &cev;
@ -3645,7 +3621,7 @@ void View::ZoneTooltip( const GpuEvent& ev )
const auto filename = GetString( srcloc.file );
const auto line = srcloc.line;
const auto func = GetString( srcloc.function );
const auto zoneName = GetString( ev.name );
const auto zoneName = GetString( srcloc.name );
const auto end = GetZoneEnd( ev );
@ -3890,7 +3866,6 @@ void View::WriteTimeline( FileWrite& f, const Vector<GpuEvent*>& vec )
f.Write( &v->gpuStart, sizeof( v->gpuStart ) );
f.Write( &v->gpuEnd, sizeof( v->gpuEnd ) );
f.Write( &v->srcloc, sizeof( v->srcloc ) );
f.Write( &v->name, sizeof( v->name ) );
WriteTimeline( f, v->child );
}
}
@ -3933,7 +3908,6 @@ void View::ReadTimeline( FileRead& f, Vector<GpuEvent*>& vec )
f.Read( &zone->gpuStart, sizeof( zone->gpuStart ) );
f.Read( &zone->gpuEnd, sizeof( zone->gpuEnd ) );
f.Read( &zone->srcloc, sizeof( zone->srcloc ) );
f.Read( &zone->name, sizeof( zone->name ) );
ReadTimeline( f, zone->child );
}
}

View File

@ -58,8 +58,6 @@ private:
void ProcessZoneEnd( const QueueZoneEnd& ev );
void ProcessFrameMark( const QueueFrameMark& ev );
void ProcessZoneText( const QueueZoneText& ev );
void ProcessZoneName( const QueueZoneName& ev );
void ProcessZoneNameLiteral( const QueueZoneName& ev );
void ProcessLockWait( const QueueLockWait& ev );
void ProcessLockObtain( const QueueLockObtain& ev );
void ProcessLockRelease( const QueueLockRelease& ev );
@ -203,6 +201,7 @@ private:
std::unordered_map<uint64_t, PlotData*> m_pendingPlots;
std::unordered_map<uint64_t, uint32_t> m_sourceLocationShrink;
std::unordered_map<uint64_t, int32_t> m_pendingSourceLocationPayload;
Vector<uint64_t> m_sourceLocationQueue;
Slab<64*1024*1024> m_slab;