mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-10 02:31:48 +00:00
Track memory usage.
This commit is contained in:
parent
e3509b6eee
commit
52f59c90bf
@ -228,6 +228,7 @@ struct MemData
|
||||
flat_hash_map<uint64_t, MemEvent*, nohash<uint64_t>> active;
|
||||
uint64_t high = std::numeric_limits<uint64_t>::min();
|
||||
uint64_t low = std::numeric_limits<uint64_t>::max();
|
||||
uint64_t usage = 0;
|
||||
};
|
||||
|
||||
struct StringLocation
|
||||
|
@ -1646,6 +1646,7 @@ void Worker::ProcessMemAlloc( const QueueMemAlloc& ev )
|
||||
|
||||
m_data.memory.low = std::min( m_data.memory.low, mem->ptr );
|
||||
m_data.memory.high = std::max( m_data.memory.high, mem->ptr + mem->size );
|
||||
m_data.memory.usage += mem->size;
|
||||
|
||||
assert( m_data.memory.active.find( ev.ptr ) == m_data.memory.active.end() );
|
||||
m_data.memory.active.emplace( ev.ptr, mem );
|
||||
@ -1661,6 +1662,7 @@ void Worker::ProcessMemFree( const QueueMemFree& ev )
|
||||
auto mem = it->second;
|
||||
mem->timeFree = TscTime( ev.time );
|
||||
mem->threadFree = CompressThread( ev.thread );
|
||||
m_data.memory.usage -= mem->size;
|
||||
m_data.memory.active.erase( it );
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user