mirror of
https://github.com/wolfpld/tracy
synced 2025-04-29 04:23:51 +00:00
Source file, function name and line number are now stored in a const static container object. This has the following benefits: - Slightly lighter profiling workload (3 instructions less). - Profiling queue event size is significantly reduced, by 12 bytes. This has an effect on all queue event types. - Source location grouping has now no cost, as it's performed at the compilation stage. This allows simplification of server code. The downside is that the full source location resolution is now performed in two steps, as the server has to query both source location container and strings contained within. This has almost no real impact on profiler operation.
32 lines
537 B
C++
Executable File
32 lines
537 B
C++
Executable File
#ifndef __TRACYSCOPED_HPP__
|
|
#define __TRACYSCOPED_HPP__
|
|
|
|
#include <stdint.h>
|
|
|
|
#include "../common/TracySystem.hpp"
|
|
#include "TracyProfiler.hpp"
|
|
|
|
namespace tracy
|
|
{
|
|
|
|
class ScopedZone
|
|
{
|
|
public:
|
|
ScopedZone( const SourceLocation* srcloc, uint32_t color )
|
|
: m_id( Profiler::ZoneBegin( QueueZoneBegin { Profiler::GetTime(), (uint64_t)srcloc, GetThreadHandle(), color } ) )
|
|
{
|
|
}
|
|
|
|
~ScopedZone()
|
|
{
|
|
Profiler::ZoneEnd( m_id, QueueZoneEnd { Profiler::GetTime() } );
|
|
}
|
|
|
|
private:
|
|
uint64_t m_id;
|
|
};
|
|
|
|
}
|
|
|
|
#endif
|