1
0
mirror of https://github.com/wolfpld/tracy.git synced 2025-03-20 07:40:02 +08:00

Add linux kernel symbol code retrieval.

This commit is contained in:
Bartosz Taudul
2024-05-26 20:48:55 +02:00
parent f8524f8bcd
commit 1ff73edd20
6 changed files with 185 additions and 1 deletions
+21
View File
@@ -1421,6 +1421,11 @@ Profiler::Profiler()
CalibrateDelay();
ReportTopology();
#ifdef __linux__
m_kcore = (KCore*)tracy_malloc( sizeof( KCore ) );
new(m_kcore) KCore();
#endif
#ifndef TRACY_NO_EXIT
const char* noExitEnv = GetEnvVar( "TRACY_NO_EXIT" );
if( noExitEnv && noExitEnv[0] == '1' )
@@ -1568,6 +1573,11 @@ Profiler::~Profiler()
EndCallstack();
#endif
#ifdef __linux__
m_kcore->~KCore();
tracy_free( m_kcore );
#endif
tracy_free( m_lz4Buf );
tracy_free( m_buffer );
LZ4_freeStream( (LZ4_stream_t*)m_stream );
@@ -3357,6 +3367,17 @@ void Profiler::HandleSymbolQueueItem( const SymbolQueueItem& si )
}
}
}
#elif defined __linux__
void* data = m_kcore->Retrieve( si.ptr, si.extra );
if( data )
{
TracyLfqPrepare( QueueType::SymbolCodeMetadata );
MemWrite( &item->symbolCodeMetadata.symbol, si.ptr );
MemWrite( &item->symbolCodeMetadata.ptr, (uint64_t)data );
MemWrite( &item->symbolCodeMetadata.size, (uint32_t)si.extra );
TracyLfqCommit;
break;
}
#endif
TracyLfqPrepare( QueueType::AckSymbolCodeNotAvailable );
TracyLfqCommit;