1
0
mirror of https://github.com/wolfpld/tracy.git synced 2025-03-20 07:40:02 +08:00

Callstack capture for ZoneBegin.

This commit is contained in:
Bartosz Taudul
2018-06-22 00:56:01 +02:00
parent c0b086240c
commit b6088b908f
5 changed files with 64 additions and 0 deletions
+23
View File
@@ -36,6 +36,29 @@ public:
tail.store( magic + 1, std::memory_order_release );
}
tracy_force_inline ScopedZone( const SourceLocation* srcloc, int depth )
{
const auto thread = GetThreadHandle();
m_thread = thread;
Magic magic;
auto& token = s_token.ptr;
auto& tail = token->get_tail_index();
auto item = token->enqueue_begin<moodycamel::CanAlloc>( magic );
MemWrite( &item->hdr.type, QueueType::ZoneBeginCallstack );
#ifdef TRACY_RDTSCP_OPT
MemWrite( &item->zoneBegin.time, Profiler::GetTime( item->zoneBegin.cpu ) );
#else
uint32_t cpu;
MemWrite( &item->zoneBegin.time, Profiler::GetTime( cpu ) );
MemWrite( &item->zoneBegin.cpu, cpu );
#endif
MemWrite( &item->zoneBegin.thread, thread );
MemWrite( &item->zoneBegin.srcloc, (uint64_t)srcloc );
tail.store( magic + 1, std::memory_order_release );
s_profiler.SendCallstack( depth, thread );
}
tracy_force_inline ~ScopedZone()
{
Magic magic;