mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-10 02:31:48 +00:00
Process Vsync frame messages.
Version bump is required due to frame set name pointer hack.
This commit is contained in:
parent
e86238642a
commit
8b4385498d
@ -7,7 +7,7 @@ namespace Version
|
||||
{
|
||||
enum { Major = 0 };
|
||||
enum { Minor = 8 };
|
||||
enum { Patch = 3 };
|
||||
enum { Patch = 4 };
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -813,6 +813,13 @@ const char* View::GetFrameSetName( const FrameData& fd, const Worker& worker )
|
||||
{
|
||||
return "Frames";
|
||||
}
|
||||
else if( fd.name >> 63 != 0 )
|
||||
{
|
||||
char* buf = bufpool[bufsel];
|
||||
bufsel = ( bufsel + 1 ) % Pool;
|
||||
sprintf( buf, "[%" PRIu32 "] Vsync", uint32_t( fd.name ) );
|
||||
return buf;
|
||||
}
|
||||
else
|
||||
{
|
||||
return worker.GetString( fd.name );
|
||||
|
@ -4675,6 +4675,9 @@ bool Worker::Process( const QueueItem& ev )
|
||||
case QueueType::FrameMarkMsgEnd:
|
||||
ProcessFrameMarkEnd( ev.frameMark );
|
||||
break;
|
||||
case QueueType::FrameVsync:
|
||||
ProcessFrameVsync( ev.frameVsync );
|
||||
break;
|
||||
case QueueType::FrameImage:
|
||||
ProcessFrameImage( ev.frameImage );
|
||||
break;
|
||||
@ -5310,6 +5313,38 @@ void Worker::ProcessFrameMarkEnd( const QueueFrameMark& ev )
|
||||
#endif
|
||||
}
|
||||
|
||||
void Worker::ProcessFrameVsync( const QueueFrameVsync& ev )
|
||||
{
|
||||
auto it = m_vsyncFrameMap.find( ev.id );
|
||||
if( it == m_vsyncFrameMap.end() )
|
||||
{
|
||||
auto fd = m_slab.AllocInit<FrameData>();
|
||||
// Hackfix workaround to maintain backwards compatibility.
|
||||
// Frame name pointers won't be in kernel space. Exploit that to store custom IDs.
|
||||
fd->name = uint64_t( m_vsyncFrameMap.size() ) | 0x8000000000000000;
|
||||
fd->continuous = 1;
|
||||
m_data.frames.AddExternal( fd );
|
||||
it = m_vsyncFrameMap.emplace( ev.id, fd ).first;
|
||||
}
|
||||
auto fd = it->second;
|
||||
assert( fd->continuous == 1 );
|
||||
const auto time = TscTime( ev.time );
|
||||
assert( fd->frames.empty() || fd->frames.back().start <= time );
|
||||
fd->frames.push_back( FrameEvent{ time, -1, -1 } );
|
||||
if( m_data.lastTime < time ) m_data.lastTime = time;
|
||||
|
||||
#ifndef TRACY_NO_STATISTICS
|
||||
const auto timeSpan = GetFrameTime( *fd, fd->frames.size() - 1 );
|
||||
if( timeSpan > 0 )
|
||||
{
|
||||
fd->min = std::min( fd->min, timeSpan );
|
||||
fd->max = std::max( fd->max, timeSpan );
|
||||
fd->total += timeSpan;
|
||||
fd->sumSq += double( timeSpan ) * timeSpan;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void Worker::ProcessFrameImage( const QueueFrameImage& ev )
|
||||
{
|
||||
assert( m_pendingFrameImageData.image != nullptr );
|
||||
|
@ -683,6 +683,7 @@ private:
|
||||
tracy_force_inline void ProcessFrameMark( const QueueFrameMark& ev );
|
||||
tracy_force_inline void ProcessFrameMarkStart( const QueueFrameMark& ev );
|
||||
tracy_force_inline void ProcessFrameMarkEnd( const QueueFrameMark& ev );
|
||||
tracy_force_inline void ProcessFrameVsync( const QueueFrameVsync& ev );
|
||||
tracy_force_inline void ProcessFrameImage( const QueueFrameImage& ev );
|
||||
tracy_force_inline void ProcessZoneText();
|
||||
tracy_force_inline void ProcessZoneName();
|
||||
@ -983,6 +984,7 @@ private:
|
||||
Vector<uint64_t> m_sourceLocationQueue;
|
||||
unordered_flat_map<uint64_t, int16_t> m_sourceLocationShrink;
|
||||
unordered_flat_map<uint64_t, ThreadData*> m_threadMap;
|
||||
unordered_flat_map<uint32_t, FrameData*> m_vsyncFrameMap;
|
||||
FrameImagePending m_pendingFrameImageData = {};
|
||||
unordered_flat_map<uint64_t, SymbolPending> m_pendingSymbols;
|
||||
unordered_flat_set<StringRef, StringRefHasher, StringRefComparator> m_pendingFileStrings;
|
||||
|
Loading…
Reference in New Issue
Block a user