mirror of
https://github.com/wolfpld/tracy
synced 2025-04-29 04:23:51 +00:00
Store sampling period.
This commit is contained in:
parent
3402d16548
commit
2b7f5091f1
@ -1024,6 +1024,7 @@ Profiler::Profiler()
|
|||||||
, m_broadcast( nullptr )
|
, m_broadcast( nullptr )
|
||||||
, m_noExit( false )
|
, m_noExit( false )
|
||||||
, m_zoneId( 1 )
|
, m_zoneId( 1 )
|
||||||
|
, m_samplingPeriod( 0 )
|
||||||
, m_stream( LZ4_createStream() )
|
, m_stream( LZ4_createStream() )
|
||||||
, m_buffer( (char*)tracy_malloc( TargetFrameSize*3 ) )
|
, m_buffer( (char*)tracy_malloc( TargetFrameSize*3 ) )
|
||||||
, m_bufferOffset( 0 )
|
, m_bufferOffset( 0 )
|
||||||
@ -1072,7 +1073,7 @@ Profiler::Profiler()
|
|||||||
new(s_compressThread) Thread( LaunchCompressWorker, this );
|
new(s_compressThread) Thread( LaunchCompressWorker, this );
|
||||||
|
|
||||||
#ifdef TRACY_HAS_SYSTEM_TRACING
|
#ifdef TRACY_HAS_SYSTEM_TRACING
|
||||||
if( SysTraceStart() )
|
if( SysTraceStart( m_samplingPeriod ) )
|
||||||
{
|
{
|
||||||
s_sysTraceThread = (Thread*)tracy_malloc( sizeof( Thread ) );
|
s_sysTraceThread = (Thread*)tracy_malloc( sizeof( Thread ) );
|
||||||
new(s_sysTraceThread) Thread( SysTraceWorker, nullptr );
|
new(s_sysTraceThread) Thread( SysTraceWorker, nullptr );
|
||||||
|
@ -619,6 +619,7 @@ private:
|
|||||||
UdpBroadcast* m_broadcast;
|
UdpBroadcast* m_broadcast;
|
||||||
bool m_noExit;
|
bool m_noExit;
|
||||||
std::atomic<uint32_t> m_zoneId;
|
std::atomic<uint32_t> m_zoneId;
|
||||||
|
int64_t m_samplingPeriod;
|
||||||
|
|
||||||
uint64_t m_threadCtx;
|
uint64_t m_threadCtx;
|
||||||
int64_t m_refTimeThread;
|
int64_t m_refTimeThread;
|
||||||
|
@ -160,7 +160,7 @@ void WINAPI EventRecordCallback( PEVENT_RECORD record )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SysTraceStart()
|
bool SysTraceStart( int64_t& samplingPeriod )
|
||||||
{
|
{
|
||||||
s_pid = GetCurrentProcessId();
|
s_pid = GetCurrentProcessId();
|
||||||
|
|
||||||
@ -191,6 +191,7 @@ bool SysTraceStart()
|
|||||||
interval.Interval = 1250; // 8 kHz
|
interval.Interval = 1250; // 8 kHz
|
||||||
const auto intervalStatus = TraceSetInformation( 0, TraceSampledProfileIntervalInfo, &interval, sizeof( interval ) );
|
const auto intervalStatus = TraceSetInformation( 0, TraceSampledProfileIntervalInfo, &interval, sizeof( interval ) );
|
||||||
if( intervalStatus != ERROR_SUCCESS ) return false;
|
if( intervalStatus != ERROR_SUCCESS ) return false;
|
||||||
|
samplingPeriod = 125*1000;
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto psz = sizeof( EVENT_TRACE_PROPERTIES ) + sizeof( KERNEL_LOGGER_NAME );
|
const auto psz = sizeof( EVENT_TRACE_PROPERTIES ) + sizeof( KERNEL_LOGGER_NAME );
|
||||||
@ -523,7 +524,7 @@ void SysTraceInjectPayload()
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
bool SysTraceStart()
|
bool SysTraceStart( int64_t& samplingPeriod )
|
||||||
{
|
{
|
||||||
if( !TraceWrite( TracingOn, sizeof( TracingOn ), "0", 2 ) ) return false;
|
if( !TraceWrite( TracingOn, sizeof( TracingOn ), "0", 2 ) ) return false;
|
||||||
if( !TraceWrite( CurrentTracer, sizeof( CurrentTracer ), "nop", 4 ) ) return false;
|
if( !TraceWrite( CurrentTracer, sizeof( CurrentTracer ), "nop", 4 ) ) return false;
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
namespace tracy
|
namespace tracy
|
||||||
{
|
{
|
||||||
|
|
||||||
bool SysTraceStart();
|
bool SysTraceStart( int64_t& samplingPeriod );
|
||||||
void SysTraceStop();
|
void SysTraceStop();
|
||||||
void SysTraceWorker( void* ptr );
|
void SysTraceWorker( void* ptr );
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user