mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-10 10:41:50 +00:00
Calculate lock wait counts.
This commit is contained in:
parent
2582f04977
commit
78067eb35e
@ -42,6 +42,7 @@ struct LockEvent
|
|||||||
int64_t time;
|
int64_t time;
|
||||||
uint64_t thread;
|
uint64_t thread;
|
||||||
uint8_t lockCount;
|
uint8_t lockCount;
|
||||||
|
uint8_t waitCount;
|
||||||
Type type;
|
Type type;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -719,25 +719,33 @@ void View::InsertLockEvent( LockMap& lockmap, LockEvent* lev )
|
|||||||
|
|
||||||
void View::UpdateLockCount( Vector<LockEvent*>& timeline, size_t pos )
|
void View::UpdateLockCount( Vector<LockEvent*>& timeline, size_t pos )
|
||||||
{
|
{
|
||||||
uint8_t count = pos == 0 ? 0 : timeline[pos-1]->lockCount;
|
uint8_t lockCount = pos == 0 ? 0 : timeline[pos-1]->lockCount;
|
||||||
|
uint8_t waitCount = pos == 0 ? 0 : timeline[pos-1]->waitCount;
|
||||||
const auto end = timeline.size();
|
const auto end = timeline.size();
|
||||||
|
|
||||||
while( pos != end )
|
while( pos != end )
|
||||||
{
|
{
|
||||||
switch( timeline[pos]->type )
|
switch( timeline[pos]->type )
|
||||||
{
|
{
|
||||||
|
case LockEvent::Type::Wait:
|
||||||
|
assert( waitCount < std::numeric_limits<uint8_t>::max() );
|
||||||
|
waitCount++;
|
||||||
|
break;
|
||||||
case LockEvent::Type::Obtain:
|
case LockEvent::Type::Obtain:
|
||||||
assert( count < std::numeric_limits<uint8_t>::max() );
|
assert( lockCount < std::numeric_limits<uint8_t>::max() );
|
||||||
count++;
|
assert( waitCount > 0 );
|
||||||
|
lockCount++;
|
||||||
|
waitCount--;
|
||||||
break;
|
break;
|
||||||
case LockEvent::Type::Release:
|
case LockEvent::Type::Release:
|
||||||
assert( count > 0 );
|
assert( lockCount > 0 );
|
||||||
count--;
|
lockCount--;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
timeline[pos]->lockCount = count;
|
timeline[pos]->lockCount = lockCount;
|
||||||
|
timeline[pos]->waitCount = waitCount;
|
||||||
pos++;
|
pos++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user