mirror of
https://github.com/wolfpld/tracy.git
synced 2025-03-20 07:40:02 +08:00
Store RingBuffer identifier.
This commit is contained in:
parent
07778badcc
commit
b7d52d2eab
@ -5,8 +5,9 @@ template<size_t Size>
|
|||||||
class RingBuffer
|
class RingBuffer
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
RingBuffer( int fd )
|
RingBuffer( int fd, int id )
|
||||||
: m_fd( fd )
|
: m_fd( fd )
|
||||||
|
, m_id( id )
|
||||||
{
|
{
|
||||||
const auto pageSize = uint32_t( getpagesize() );
|
const auto pageSize = uint32_t( getpagesize() );
|
||||||
assert( Size >= pageSize );
|
assert( Size >= pageSize );
|
||||||
@ -49,6 +50,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool IsValid() const { return m_metadata != nullptr; }
|
bool IsValid() const { return m_metadata != nullptr; }
|
||||||
|
int GetId() const { return m_id; }
|
||||||
|
|
||||||
void Enable()
|
void Enable()
|
||||||
{
|
{
|
||||||
@ -111,6 +113,7 @@ private:
|
|||||||
|
|
||||||
size_t m_mapSize;
|
size_t m_mapSize;
|
||||||
int m_fd;
|
int m_fd;
|
||||||
|
int m_id;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -675,6 +675,11 @@ static int perf_event_open( struct perf_event_attr* hw_event, pid_t pid, int cpu
|
|||||||
return syscall( __NR_perf_event_open, hw_event, pid, cpu, group_fd, flags );
|
return syscall( __NR_perf_event_open, hw_event, pid, cpu, group_fd, flags );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
enum TraceEventId
|
||||||
|
{
|
||||||
|
EventCallstack
|
||||||
|
};
|
||||||
|
|
||||||
static void SetupSampling( int64_t& samplingPeriod )
|
static void SetupSampling( int64_t& samplingPeriod )
|
||||||
{
|
{
|
||||||
#ifndef CLOCK_MONOTONIC_RAW
|
#ifndef CLOCK_MONOTONIC_RAW
|
||||||
@ -715,7 +720,7 @@ static void SetupSampling( int64_t& samplingPeriod )
|
|||||||
tracy_free( s_ring );
|
tracy_free( s_ring );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
new( s_ring+i ) RingBuffer<RingBufSize>( fd );
|
new( s_ring+i ) RingBuffer<RingBufSize>( fd, EventCallstack );
|
||||||
}
|
}
|
||||||
|
|
||||||
s_threadSampling = (Thread*)tracy_malloc( sizeof( Thread ) );
|
s_threadSampling = (Thread*)tracy_malloc( sizeof( Thread ) );
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user