mirror of
https://github.com/wolfpld/tracy
synced 2025-04-30 20:53:52 +00:00
Separate thread context data getter.
This commit is contained in:
parent
ad46f981f9
commit
b69bf49082
@ -5092,6 +5092,44 @@ int View::DrawLocks( uint64_t tid, bool hover, double pxns, const ImVec2& wpos,
|
|||||||
return cnt;
|
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 )
|
int View::DrawCpuData( int offset, double pxns, const ImVec2& wpos, bool hover, float yMin, float yMax )
|
||||||
{
|
{
|
||||||
const auto w = ImGui::GetWindowContentRegionWidth() - 1;
|
const auto w = ImGui::GetWindowContentRegionWidth() - 1;
|
||||||
@ -5271,37 +5309,10 @@ int View::DrawCpuData( int offset, double pxns, const ImVec2& wpos, bool hover,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
char buf[256];
|
|
||||||
const auto thread = m_worker.DecompressThreadExternal( it->Thread() );
|
const auto thread = m_worker.DecompressThreadExternal( it->Thread() );
|
||||||
const auto local = m_worker.IsThreadLocal( thread );
|
bool local, untracked;
|
||||||
auto txt = local ? m_worker.GetThreadName( thread ) : m_worker.GetExternalName( thread ).first;
|
const char* txt;
|
||||||
auto label = txt;
|
auto label = GetThreadContextData( thread, local, untracked, 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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
const auto pr0 = ( start - m_vd.zvStart ) * pxns;
|
const auto pr0 = ( start - m_vd.zvStart ) * pxns;
|
||||||
const auto pr1 = ( end - m_vd.zvStart ) * pxns;
|
const auto pr1 = ( end - m_vd.zvStart ) * pxns;
|
||||||
const auto px0 = std::max( pr0, -10.0 );
|
const auto px0 = std::max( pr0, -10.0 );
|
||||||
|
@ -244,6 +244,7 @@ private:
|
|||||||
int64_t GetZoneSelfTime( const ZoneEvent& zone );
|
int64_t GetZoneSelfTime( const ZoneEvent& zone );
|
||||||
int64_t GetZoneSelfTime( const GpuEvent& zone );
|
int64_t GetZoneSelfTime( const GpuEvent& zone );
|
||||||
bool GetZoneRunningTime( const ContextSwitch* ctx, const ZoneEvent& ev, int64_t& time, uint64_t& cnt );
|
bool GetZoneRunningTime( const ContextSwitch* ctx, const ZoneEvent& ev, int64_t& time, uint64_t& cnt );
|
||||||
|
const char* GetThreadContextData( uint64_t thread, bool& local, bool& untracked, const char*& program );
|
||||||
|
|
||||||
tracy_force_inline void CalcZoneTimeData( unordered_flat_map<int16_t, ZoneTimeData>& data, int64_t& ztime, const ZoneEvent& zone );
|
tracy_force_inline void CalcZoneTimeData( unordered_flat_map<int16_t, ZoneTimeData>& data, int64_t& ztime, const ZoneEvent& zone );
|
||||||
tracy_force_inline void CalcZoneTimeData( const ContextSwitch* ctx, unordered_flat_map<int16_t, ZoneTimeData>& data, int64_t& ztime, const ZoneEvent& zone );
|
tracy_force_inline void CalcZoneTimeData( const ContextSwitch* ctx, unordered_flat_map<int16_t, ZoneTimeData>& data, int64_t& ztime, const ZoneEvent& zone );
|
||||||
|
Loading…
x
Reference in New Issue
Block a user