mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-10 02:31:48 +00:00
More utility extract.
This commit is contained in:
parent
701cc16cbf
commit
b58a206d9d
@ -5504,44 +5504,6 @@ int View::DrawLocks( uint64_t tid, bool hover, double pxns, const ImVec2& wpos,
|
||||
return cnt;
|
||||
}
|
||||
|
||||
const char* View::GetThreadContextData( uint64_t thread, bool& _local, bool& _untracked, const char*& program )
|
||||
{
|
||||
static char buf[256];
|
||||
const auto local = m_worker.IsThreadLocal( thread );
|
||||
auto txt = local ? m_worker.GetThreadName( thread ) : m_worker.GetExternalName( thread ).first;
|
||||
auto label = txt;
|
||||
bool untracked = false;
|
||||
if( !local )
|
||||
{
|
||||
if( m_worker.GetPid() == 0 )
|
||||
{
|
||||
untracked = strcmp( txt, m_worker.GetCaptureProgram().c_str() ) == 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
const auto pid = m_worker.GetPidFromTid( thread );
|
||||
untracked = pid == m_worker.GetPid();
|
||||
if( untracked )
|
||||
{
|
||||
label = txt = m_worker.GetExternalName( thread ).second;
|
||||
}
|
||||
else
|
||||
{
|
||||
const auto ttxt = m_worker.GetExternalName( thread ).second;
|
||||
if( strcmp( ttxt, "???" ) != 0 && strcmp( ttxt, txt ) != 0 )
|
||||
{
|
||||
snprintf( buf, 256, "%s (%s)", txt, ttxt );
|
||||
label = buf;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
_local = local;
|
||||
_untracked = untracked;
|
||||
program = txt;
|
||||
return label;
|
||||
}
|
||||
|
||||
int View::DrawCpuData( int offset, double pxns, const ImVec2& wpos, bool hover, float yMin, float yMax )
|
||||
{
|
||||
auto cpuData = m_worker.GetCpuData();
|
||||
|
@ -805,4 +805,42 @@ const char* View::ShortenNamespace( const char* name ) const
|
||||
}
|
||||
}
|
||||
|
||||
const char* View::GetThreadContextData( uint64_t thread, bool& _local, bool& _untracked, const char*& program )
|
||||
{
|
||||
static char buf[256];
|
||||
const auto local = m_worker.IsThreadLocal( thread );
|
||||
auto txt = local ? m_worker.GetThreadName( thread ) : m_worker.GetExternalName( thread ).first;
|
||||
auto label = txt;
|
||||
bool untracked = false;
|
||||
if( !local )
|
||||
{
|
||||
if( m_worker.GetPid() == 0 )
|
||||
{
|
||||
untracked = strcmp( txt, m_worker.GetCaptureProgram().c_str() ) == 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
const auto pid = m_worker.GetPidFromTid( thread );
|
||||
untracked = pid == m_worker.GetPid();
|
||||
if( untracked )
|
||||
{
|
||||
label = txt = m_worker.GetExternalName( thread ).second;
|
||||
}
|
||||
else
|
||||
{
|
||||
const auto ttxt = m_worker.GetExternalName( thread ).second;
|
||||
if( strcmp( ttxt, "???" ) != 0 && strcmp( ttxt, txt ) != 0 )
|
||||
{
|
||||
snprintf( buf, 256, "%s (%s)", txt, ttxt );
|
||||
label = buf;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
_local = local;
|
||||
_untracked = untracked;
|
||||
program = txt;
|
||||
return label;
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user