Use possibly-synchronous macros for Lua zones.

This commit is contained in:
Bartosz Taudul 2021-10-09 15:41:27 +02:00
parent fcda1f6a7f
commit 7c046eb7ac
No known key found for this signature in database
GPG Key ID: B7FE2008B7575DF3

View File

@ -209,10 +209,10 @@ static inline int LuaZoneBeginS( lua_State* L )
lua_getinfo( L, "Snl", &dbg ); lua_getinfo( L, "Snl", &dbg );
const auto srcloc = Profiler::AllocSourceLocation( dbg.currentline, dbg.source, dbg.name ? dbg.name : dbg.short_src ); const auto srcloc = Profiler::AllocSourceLocation( dbg.currentline, dbg.source, dbg.name ? dbg.name : dbg.short_src );
TracyLfqPrepare( QueueType::ZoneBeginAllocSrcLocCallstack ); TracyQueuePrepare( QueueType::ZoneBeginAllocSrcLocCallstack );
MemWrite( &item->zoneBegin.time, Profiler::GetTime() ); MemWrite( &item->zoneBegin.time, Profiler::GetTime() );
MemWrite( &item->zoneBegin.srcloc, srcloc ); MemWrite( &item->zoneBegin.srcloc, srcloc );
TracyLfqCommit; TracyQueueCommit( zoneBeginThread );
return 0; return 0;
} }
@ -240,10 +240,10 @@ static inline int LuaZoneBeginNS( lua_State* L )
const auto name = lua_tolstring( L, 1, &nsz ); const auto name = lua_tolstring( L, 1, &nsz );
const auto srcloc = Profiler::AllocSourceLocation( dbg.currentline, dbg.source, dbg.name ? dbg.name : dbg.short_src, name, nsz ); const auto srcloc = Profiler::AllocSourceLocation( dbg.currentline, dbg.source, dbg.name ? dbg.name : dbg.short_src, name, nsz );
TracyLfqPrepare( QueueType::ZoneBeginAllocSrcLocCallstack ); TracyQueuePrepare( QueueType::ZoneBeginAllocSrcLocCallstack );
MemWrite( &item->zoneBegin.time, Profiler::GetTime() ); MemWrite( &item->zoneBegin.time, Profiler::GetTime() );
MemWrite( &item->zoneBegin.srcloc, srcloc ); MemWrite( &item->zoneBegin.srcloc, srcloc );
TracyLfqCommit; TracyQueueCommit( zoneBeginThread );
return 0; return 0;
} }
@ -266,10 +266,10 @@ static inline int LuaZoneBegin( lua_State* L )
lua_getinfo( L, "Snl", &dbg ); lua_getinfo( L, "Snl", &dbg );
const auto srcloc = Profiler::AllocSourceLocation( dbg.currentline, dbg.source, dbg.name ? dbg.name : dbg.short_src ); const auto srcloc = Profiler::AllocSourceLocation( dbg.currentline, dbg.source, dbg.name ? dbg.name : dbg.short_src );
TracyLfqPrepare( QueueType::ZoneBeginAllocSrcLoc ); TracyQueuePrepare( QueueType::ZoneBeginAllocSrcLoc );
MemWrite( &item->zoneBegin.time, Profiler::GetTime() ); MemWrite( &item->zoneBegin.time, Profiler::GetTime() );
MemWrite( &item->zoneBegin.srcloc, srcloc ); MemWrite( &item->zoneBegin.srcloc, srcloc );
TracyLfqCommit; TracyQueueCommit( zoneBeginThread );
return 0; return 0;
#endif #endif
} }
@ -293,10 +293,10 @@ static inline int LuaZoneBeginN( lua_State* L )
const auto name = lua_tolstring( L, 1, &nsz ); const auto name = lua_tolstring( L, 1, &nsz );
const auto srcloc = Profiler::AllocSourceLocation( dbg.currentline, dbg.source, dbg.name ? dbg.name : dbg.short_src, name, nsz ); const auto srcloc = Profiler::AllocSourceLocation( dbg.currentline, dbg.source, dbg.name ? dbg.name : dbg.short_src, name, nsz );
TracyLfqPrepare( QueueType::ZoneBeginAllocSrcLoc ); TracyQueuePrepare( QueueType::ZoneBeginAllocSrcLoc );
MemWrite( &item->zoneBegin.time, Profiler::GetTime() ); MemWrite( &item->zoneBegin.time, Profiler::GetTime() );
MemWrite( &item->zoneBegin.srcloc, srcloc ); MemWrite( &item->zoneBegin.srcloc, srcloc );
TracyLfqCommit; TracyQueueCommit( zoneBeginThread );
return 0; return 0;
#endif #endif
} }
@ -314,9 +314,9 @@ static inline int LuaZoneEnd( lua_State* L )
} }
#endif #endif
TracyLfqPrepare( QueueType::ZoneEnd ); TracyQueuePrepare( QueueType::ZoneEnd );
MemWrite( &item->zoneEnd.time, Profiler::GetTime() ); MemWrite( &item->zoneEnd.time, Profiler::GetTime() );
TracyLfqCommit; TracyQueueCommit( zoneEndThread );
return 0; return 0;
} }
@ -338,10 +338,10 @@ static inline int LuaZoneText( lua_State* L )
auto ptr = (char*)tracy_malloc( size ); auto ptr = (char*)tracy_malloc( size );
memcpy( ptr, txt, size ); memcpy( ptr, txt, size );
TracyLfqPrepare( QueueType::ZoneText ); TracyQueuePrepare( QueueType::ZoneText );
MemWrite( &item->zoneTextFat.text, (uint64_t)ptr ); MemWrite( &item->zoneTextFat.text, (uint64_t)ptr );
MemWrite( &item->zoneTextFat.size, (uint16_t)size ); MemWrite( &item->zoneTextFat.size, (uint16_t)size );
TracyLfqCommit; TracyQueueCommit( zoneTextFatThread );
return 0; return 0;
} }
@ -363,10 +363,10 @@ static inline int LuaZoneName( lua_State* L )
auto ptr = (char*)tracy_malloc( size ); auto ptr = (char*)tracy_malloc( size );
memcpy( ptr, txt, size ); memcpy( ptr, txt, size );
TracyLfqPrepare( QueueType::ZoneName ); TracyQueuePrepare( QueueType::ZoneName );
MemWrite( &item->zoneTextFat.text, (uint64_t)ptr ); MemWrite( &item->zoneTextFat.text, (uint64_t)ptr );
MemWrite( &item->zoneTextFat.size, (uint16_t)size ); MemWrite( &item->zoneTextFat.size, (uint16_t)size );
TracyLfqCommit; TracyQueueCommit( zoneTextFatThread );
return 0; return 0;
} }