mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-22 14:44:34 +00:00
Store thread id next to zone ptr in source location zone list.
This commit is contained in:
parent
777d672e05
commit
d0519499f4
@ -129,4 +129,4 @@ Lua instrumentation needs to perform additional work (including memory allocatio
|
||||
|
||||
You may use named colors predefined in `common/TracyColor.hpp` (included by `Tracy.hpp`). Visual reference: [wikipedia](https://en.wikipedia.org/wiki/X11_color_names).
|
||||
|
||||
Tracy server will perform statistical data collection on the fly, if the macro `TRACY_NO_STATISTICS` is not defined. This allows extended analysis of the trace (for example, you can perform a live search for matching zones) at a small CPU processing cost and a considerable memory usage increase (at least 8 bytes per zone).
|
||||
Tracy server will perform statistical data collection on the fly, if the macro `TRACY_NO_STATISTICS` is not defined. This allows extended analysis of the trace (for example, you can perform a live search for matching zones) at a small CPU processing cost and a considerable memory usage increase (at least 10 bytes per zone).
|
||||
|
@ -2805,7 +2805,7 @@ void View::DrawFindZone()
|
||||
const auto idt = numBins / ( log10( tmax ) - tMinLog );
|
||||
for( auto& ev : zones )
|
||||
{
|
||||
const auto timeSpan = m_worker.GetZoneEndDirect( *ev ) - ev->start;
|
||||
const auto timeSpan = m_worker.GetZoneEndDirect( *ev.zone ) - ev.zone->start;
|
||||
if( timeSpan != 0 )
|
||||
{
|
||||
const auto bin = std::min( numBins - 1, int64_t( ( log10( timeSpan ) - tMinLog ) * idt ) );
|
||||
@ -2820,7 +2820,7 @@ void View::DrawFindZone()
|
||||
const auto idt = numBins / dt;
|
||||
for( auto& ev : zones )
|
||||
{
|
||||
const auto timeSpan = m_worker.GetZoneEndDirect( *ev ) - ev->start;
|
||||
const auto timeSpan = m_worker.GetZoneEndDirect( *ev.zone ) - ev.zone->start;
|
||||
if( timeSpan != 0 )
|
||||
{
|
||||
const auto bin = std::min( numBins - 1, int64_t( ( timeSpan - tmin ) * idt ) );
|
||||
@ -2839,7 +2839,7 @@ void View::DrawFindZone()
|
||||
const auto idt = numBins / ( log10( tmax ) - tMinLog );
|
||||
for( auto& ev : zones )
|
||||
{
|
||||
const auto timeSpan = m_worker.GetZoneEndDirect( *ev ) - ev->start;
|
||||
const auto timeSpan = m_worker.GetZoneEndDirect( *ev.zone ) - ev.zone->start;
|
||||
if( timeSpan != 0 )
|
||||
{
|
||||
const auto bin = std::min( numBins - 1, int64_t( ( log10( timeSpan ) - tMinLog ) * idt ) );
|
||||
@ -2853,7 +2853,7 @@ void View::DrawFindZone()
|
||||
const auto idt = numBins / dt;
|
||||
for( auto& ev : zones )
|
||||
{
|
||||
const auto timeSpan = m_worker.GetZoneEndDirect( *ev ) - ev->start;
|
||||
const auto timeSpan = m_worker.GetZoneEndDirect( *ev.zone ) - ev.zone->start;
|
||||
if( timeSpan != 0 )
|
||||
{
|
||||
const auto bin = std::min( numBins - 1, int64_t( ( timeSpan - tmin ) * idt ) );
|
||||
@ -3138,8 +3138,8 @@ void View::DrawFindZone()
|
||||
{
|
||||
auto& ev = zones[i];
|
||||
|
||||
const auto end = m_worker.GetZoneEndDirect( *ev );
|
||||
const auto timespan = end - ev->start;
|
||||
const auto end = m_worker.GetZoneEndDirect( *ev.zone );
|
||||
const auto timespan = end - ev.zone->start;
|
||||
|
||||
if( m_findZone.highlight.active )
|
||||
{
|
||||
@ -3148,10 +3148,9 @@ void View::DrawFindZone()
|
||||
if( timespan < s || timespan > e ) continue;
|
||||
}
|
||||
|
||||
auto thread = GetZoneThread( *ev );
|
||||
if( thread != 0 )
|
||||
if( ev.thread != 0 )
|
||||
{
|
||||
m_findZone.threads[thread].emplace_back( ev );
|
||||
m_findZone.threads[ev.thread].emplace_back( ev.zone );
|
||||
}
|
||||
}
|
||||
m_findZone.processed = sz;
|
||||
@ -3159,15 +3158,16 @@ void View::DrawFindZone()
|
||||
int idx = 0;
|
||||
for( auto& v : m_findZone.threads )
|
||||
{
|
||||
auto threadString = m_worker.GetThreadString( m_worker.DecompressThread( v.first ) );
|
||||
ImGui::PushID( idx++ );
|
||||
const bool expand = ImGui::TreeNode( m_worker.GetThreadString( v.first ) );
|
||||
const bool expand = ImGui::TreeNode( threadString );
|
||||
ImGui::PopID();
|
||||
ImGui::SameLine();
|
||||
ImGui::TextColored( ImVec4( 0.5f, 0.5f, 0.5f, 1.0f ), "(%s)", RealToString( v.second.size(), true ) );
|
||||
|
||||
if( expand )
|
||||
{
|
||||
ImGui::Columns( 3, m_worker.GetThreadString( v.first ) );
|
||||
ImGui::Columns( 3, threadString );
|
||||
ImGui::Separator();
|
||||
ImGui::Text( "Name" );
|
||||
ImGui::NextColumn();
|
||||
|
@ -193,7 +193,7 @@ Worker::Worker( FileRead& f )
|
||||
auto td = m_slab.AllocInit<ThreadData>();
|
||||
f.Read( &td->id, sizeof( td->id ) );
|
||||
f.Read( &td->count, sizeof( td->count ) );
|
||||
ReadTimeline( f, td->timeline );
|
||||
ReadTimeline( f, td->timeline, CompressThread( td->id ) );
|
||||
uint64_t msz;
|
||||
f.Read( &msz, sizeof( msz ) );
|
||||
td->messages.reserve( msz );
|
||||
@ -723,7 +723,7 @@ void Worker::NewZone( ZoneEvent* zone, uint64_t thread )
|
||||
#ifndef TRACY_NO_STATISTICS
|
||||
auto it = m_data.sourceLocationZones.find( zone->srcloc );
|
||||
assert( it != m_data.sourceLocationZones.end() );
|
||||
it->second.zones.push_back( zone );
|
||||
it->second.zones.push_back( ZoneThreadData { zone, CompressThread( thread ) } );
|
||||
#endif
|
||||
|
||||
auto td = NoticeThread( thread );
|
||||
@ -1623,13 +1623,13 @@ void Worker::ProcessGpuResync( const QueueGpuResync& ev )
|
||||
}
|
||||
}
|
||||
|
||||
void Worker::ReadTimeline( FileRead& f, Vector<ZoneEvent*>& vec )
|
||||
void Worker::ReadTimeline( FileRead& f, Vector<ZoneEvent*>& vec, uint16_t thread )
|
||||
{
|
||||
uint64_t sz;
|
||||
f.Read( &sz, sizeof( sz ) );
|
||||
if( sz != 0 )
|
||||
{
|
||||
ReadTimeline( f, vec, sz );
|
||||
ReadTimeline( f, vec, thread, sz );
|
||||
}
|
||||
}
|
||||
|
||||
@ -1643,7 +1643,7 @@ void Worker::ReadTimeline( FileRead& f, Vector<GpuEvent*>& vec )
|
||||
}
|
||||
}
|
||||
|
||||
void Worker::ReadTimeline( FileRead& f, Vector<ZoneEvent*>& vec, uint64_t size )
|
||||
void Worker::ReadTimeline( FileRead& f, Vector<ZoneEvent*>& vec, uint16_t thread, uint64_t size )
|
||||
{
|
||||
assert( size != 0 );
|
||||
vec.reserve_non_zero( size );
|
||||
@ -1659,7 +1659,7 @@ void Worker::ReadTimeline( FileRead& f, Vector<ZoneEvent*>& vec, uint64_t size )
|
||||
#ifndef TRACY_NO_STATISTICS
|
||||
auto it = m_data.sourceLocationZones.find( zone->srcloc );
|
||||
assert( it != m_data.sourceLocationZones.end() );
|
||||
it->second.zones.push_back( zone );
|
||||
it->second.zones.push_back( ZoneThreadData { zone, thread } );
|
||||
|
||||
if( zone->end != -1 )
|
||||
{
|
||||
@ -1672,7 +1672,7 @@ void Worker::ReadTimeline( FileRead& f, Vector<ZoneEvent*>& vec, uint64_t size )
|
||||
}
|
||||
#endif
|
||||
|
||||
ReadTimeline( f, zone->child );
|
||||
ReadTimeline( f, zone->child, thread );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -33,11 +33,19 @@ struct nohash
|
||||
|
||||
class Worker
|
||||
{
|
||||
#pragma pack( 1 )
|
||||
struct ZoneThreadData
|
||||
{
|
||||
ZoneEvent* zone;
|
||||
uint16_t thread;
|
||||
};
|
||||
#pragma pack()
|
||||
|
||||
struct SourceLocationZones
|
||||
{
|
||||
SourceLocationZones() : min( std::numeric_limits<int64_t>::max() ), max( std::numeric_limits<int64_t>::min() ) {}
|
||||
|
||||
Vector<ZoneEvent*> zones;
|
||||
Vector<ZoneThreadData> zones;
|
||||
int64_t min;
|
||||
int64_t max;
|
||||
};
|
||||
@ -200,10 +208,10 @@ private:
|
||||
|
||||
StringLocation StoreString( char* str, size_t sz );
|
||||
|
||||
tracy_force_inline void ReadTimeline( FileRead& f, Vector<ZoneEvent*>& vec );
|
||||
tracy_force_inline void ReadTimeline( FileRead& f, Vector<ZoneEvent*>& vec, uint16_t thread );
|
||||
tracy_force_inline void ReadTimeline( FileRead& f, Vector<GpuEvent*>& vec );
|
||||
|
||||
void ReadTimeline( FileRead& f, Vector<ZoneEvent*>& vec, uint64_t size );
|
||||
void ReadTimeline( FileRead& f, Vector<ZoneEvent*>& vec, uint16_t thread, uint64_t size );
|
||||
void ReadTimeline( FileRead& f, Vector<GpuEvent*>& vec, uint64_t size );
|
||||
|
||||
void WriteTimeline( FileWrite& f, const Vector<ZoneEvent*>& vec );
|
||||
|
Loading…
Reference in New Issue
Block a user