mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-10 10:41:50 +00:00
Save one byte on ContextSwitchData.
This commit is contained in:
parent
d77c87ae1c
commit
f285e0f5cc
@ -222,11 +222,13 @@ enum { CrashEventSize = sizeof( CrashEvent ) };
|
|||||||
|
|
||||||
struct ContextSwitchData
|
struct ContextSwitchData
|
||||||
{
|
{
|
||||||
|
static uint8_t Reason( const ContextSwitchData& cs ) { return cs.data & 0xF; }
|
||||||
|
static uint8_t State( const ContextSwitchData& cs ) { return cs.data >> 4; }
|
||||||
|
|
||||||
int64_t start;
|
int64_t start;
|
||||||
int64_t end;
|
int64_t end;
|
||||||
uint8_t cpu;
|
uint8_t cpu;
|
||||||
int8_t reason;
|
uint8_t data;
|
||||||
int8_t state;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
enum { ContextSwitchDataSize = sizeof( ContextSwitchData ) };
|
enum { ContextSwitchDataSize = sizeof( ContextSwitchData ) };
|
||||||
|
@ -1168,7 +1168,7 @@ Worker::Worker( FileRead& f, EventType::Type eventMask )
|
|||||||
{
|
{
|
||||||
ptr->start = ReadTimeOffset( f, refTime );
|
ptr->start = ReadTimeOffset( f, refTime );
|
||||||
ptr->end = ReadTimeOffset( f, refTime );
|
ptr->end = ReadTimeOffset( f, refTime );
|
||||||
f.Read( &ptr->cpu, sizeof( ptr->cpu ) + sizeof( ptr->reason ) + sizeof( ptr->state ) );
|
f.Read( &ptr->cpu, sizeof( ptr->cpu ) + sizeof( ptr->data ) );
|
||||||
ptr++;
|
ptr++;
|
||||||
}
|
}
|
||||||
m_data.ctxSwitch.emplace( thread, data );
|
m_data.ctxSwitch.emplace( thread, data );
|
||||||
@ -3727,8 +3727,9 @@ void Worker::ProcessContextSwitch( const QueueContextSwitch& ev )
|
|||||||
auto& item = data.back();
|
auto& item = data.back();
|
||||||
assert( item.start <= time );
|
assert( item.start <= time );
|
||||||
item.end = time;
|
item.end = time;
|
||||||
item.reason = ev.reason;
|
assert( ( ev.reason & 0xF ) == ev.reason );
|
||||||
item.state = ev.state;
|
assert( ( ev.state & 0xF ) == ev.state );
|
||||||
|
item.data = ev.reason | ( ev.state << 4 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if( ev.newThread != 0 )
|
if( ev.newThread != 0 )
|
||||||
@ -3745,8 +3746,7 @@ void Worker::ProcessContextSwitch( const QueueContextSwitch& ev )
|
|||||||
item.start = time;
|
item.start = time;
|
||||||
item.end = -1;
|
item.end = -1;
|
||||||
item.cpu = ev.cpu;
|
item.cpu = ev.cpu;
|
||||||
item.reason = -1;
|
item.data = ~0;
|
||||||
item.state = -1;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4497,7 +4497,7 @@ void Worker::Write( FileWrite& f )
|
|||||||
{
|
{
|
||||||
WriteTimeOffset( f, refTime, cs.start );
|
WriteTimeOffset( f, refTime, cs.start );
|
||||||
WriteTimeOffset( f, refTime, cs.end );
|
WriteTimeOffset( f, refTime, cs.end );
|
||||||
f.Write( &cs.cpu, sizeof( cs.cpu ) + sizeof( cs.reason ) + sizeof( cs.state ) );
|
f.Write( &cs.cpu, sizeof( cs.cpu ) + sizeof( cs.data ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user