Send frame markers.

This commit is contained in:
Bartosz Taudul 2017-09-16 00:30:27 +02:00
parent 90cdda8542
commit 03ece0ac48
5 changed files with 15 additions and 0 deletions

View File

@ -1,8 +1,10 @@
#ifndef __TRACY_HPP__
#define __TRACY_HPP__
#include "TracyProfiler.hpp"
#include "TracyScoped.hpp"
#define ZoneScoped tracy::ScopedZone ___tracy_scoped_zone( __FILE__, __FUNCTION__, __LINE__ );
#define FrameMark tracy::Profiler::FrameMark();
#endif

View File

@ -75,6 +75,14 @@ void Profiler::ZoneEnd( uint64_t id, QueueZoneEnd&& data )
s_instance->m_queue.enqueue( GetToken(), std::move( item ) );
}
void Profiler::FrameMark()
{
QueueItem item;
item.hdr.type = QueueType::FrameMark;
item.hdr.id = (uint64_t)GetTime();
s_instance->m_queue.enqueue( GetToken(), std::move( item ) );
}
Profiler* Profiler::Instance()
{
return s_instance;

View File

@ -29,6 +29,7 @@ public:
static uint64_t ZoneBegin( QueueZoneBegin&& data );
static void ZoneEnd( uint64_t id, QueueZoneEnd&& data );
static void FrameMark();
static bool ShouldExit();

View File

@ -11,6 +11,7 @@ enum class QueueType : uint8_t
ZoneBegin,
ZoneEnd,
StringData,
FrameMark,
NUM_TYPES
};
@ -57,6 +58,7 @@ static const size_t QueueDataSize[] = {
sizeof( QueueHeader ) + sizeof( QueueZoneBegin ),
sizeof( QueueHeader ) + sizeof( QueueZoneEnd ),
sizeof( QueueHeader ),
sizeof( QueueHeader ),
};
static_assert( sizeof( QueueDataSize ) / sizeof( size_t ) == (uint8_t)QueueType::NUM_TYPES, "QueueDataSize mismatch" );

View File

@ -168,6 +168,8 @@ void View::Process( const QueueItem& ev )
case QueueType::ZoneEnd:
ProcessZoneEnd( ev.hdr.id, ev.zoneEnd );
break;
case QueueType::FrameMark:
break;
default:
assert( false );
break;