mirror of
https://github.com/wolfpld/tracy.git
synced 2025-03-20 07:40:02 +08:00
Count kernel samples.
This commit is contained in:
parent
7086f2db65
commit
d49da69972
@ -603,6 +603,7 @@ struct ThreadData
|
|||||||
#endif
|
#endif
|
||||||
Vector<SampleData> samples;
|
Vector<SampleData> samples;
|
||||||
SampleData pendingSample;
|
SampleData pendingSample;
|
||||||
|
uint64_t kernelSampleCnt;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct GpuCtxThreadData
|
struct GpuCtxThreadData
|
||||||
|
|||||||
@ -920,7 +920,15 @@ Worker::Worker( FileRead& f, EventType::Type eventMask, bool bgTasks )
|
|||||||
{
|
{
|
||||||
auto td = m_slab.AllocInit<ThreadData>();
|
auto td = m_slab.AllocInit<ThreadData>();
|
||||||
uint64_t tid;
|
uint64_t tid;
|
||||||
f.Read2( tid, td->count );
|
if( fileVer >= FileVersion( 0, 7, 9 ) )
|
||||||
|
{
|
||||||
|
f.Read3( tid, td->count, td->kernelSampleCnt );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
f.Read2( tid, td->count );
|
||||||
|
td->kernelSampleCnt = 0;
|
||||||
|
}
|
||||||
td->id = tid;
|
td->id = tid;
|
||||||
m_data.zonesCnt += td->count;
|
m_data.zonesCnt += td->count;
|
||||||
if( fileVer < FileVersion( 0, 6, 3 ) )
|
if( fileVer < FileVersion( 0, 6, 3 ) )
|
||||||
@ -3501,6 +3509,7 @@ ThreadData* Worker::NewThread( uint64_t thread )
|
|||||||
#ifndef TRACY_NO_STATISTICS
|
#ifndef TRACY_NO_STATISTICS
|
||||||
td->ghostIdx = 0;
|
td->ghostIdx = 0;
|
||||||
#endif
|
#endif
|
||||||
|
td->kernelSampleCnt = 0;
|
||||||
td->pendingSample.time.Clear();
|
td->pendingSample.time.Clear();
|
||||||
m_data.threads.push_back( td );
|
m_data.threads.push_back( td );
|
||||||
m_threadMap.emplace( thread, td );
|
m_threadMap.emplace( thread, td );
|
||||||
@ -5868,6 +5877,10 @@ void Worker::ProcessCallstackSampleImpl( const SampleData& sd, ThreadData& td, i
|
|||||||
assert( sd.callstack.Val() == callstack );
|
assert( sd.callstack.Val() == callstack );
|
||||||
m_data.samplesCnt++;
|
m_data.samplesCnt++;
|
||||||
|
|
||||||
|
const auto& cs = GetCallstack( callstack );
|
||||||
|
const auto& ip = cs[0];
|
||||||
|
if( GetCanonicalPointer( ip ) >> 63 != 0 ) td.kernelSampleCnt++;
|
||||||
|
|
||||||
if( td.samples.empty() )
|
if( td.samples.empty() )
|
||||||
{
|
{
|
||||||
td.samples.push_back( sd );
|
td.samples.push_back( sd );
|
||||||
@ -5879,9 +5892,7 @@ void Worker::ProcessCallstackSampleImpl( const SampleData& sd, ThreadData& td, i
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifndef TRACY_NO_STATISTICS
|
#ifndef TRACY_NO_STATISTICS
|
||||||
const auto& cs = GetCallstack( callstack );
|
|
||||||
{
|
{
|
||||||
const auto& ip = cs[0];
|
|
||||||
auto frame = GetCallstackFrame( ip );
|
auto frame = GetCallstackFrame( ip );
|
||||||
if( frame )
|
if( frame )
|
||||||
{
|
{
|
||||||
@ -7379,6 +7390,7 @@ void Worker::Write( FileWrite& f, bool fiDict )
|
|||||||
int64_t refTime = 0;
|
int64_t refTime = 0;
|
||||||
f.Write( &thread->id, sizeof( thread->id ) );
|
f.Write( &thread->id, sizeof( thread->id ) );
|
||||||
f.Write( &thread->count, sizeof( thread->count ) );
|
f.Write( &thread->count, sizeof( thread->count ) );
|
||||||
|
f.Write( &thread->kernelSampleCnt, sizeof( thread->kernelSampleCnt ) );
|
||||||
WriteTimeline( f, thread->timeline, refTime );
|
WriteTimeline( f, thread->timeline, refTime );
|
||||||
sz = thread->messages.size();
|
sz = thread->messages.size();
|
||||||
f.Write( &sz, sizeof( sz ) );
|
f.Write( &sz, sizeof( sz ) );
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user