mirror of
https://github.com/wolfpld/tracy.git
synced 2025-03-20 07:40:02 +08:00
Only include memory events from zone thread.
This commit is contained in:
parent
4584ef9e88
commit
bbf1e9f111
@ -2678,6 +2678,8 @@ void View::DrawZoneInfoWindow()
|
|||||||
{
|
{
|
||||||
ImGui::Separator();
|
ImGui::Separator();
|
||||||
|
|
||||||
|
const auto thread = m_worker.CompressThread( tid );
|
||||||
|
|
||||||
auto ait = std::lower_bound( mem.data.begin(), mem.data.end(), ev.start, [] ( const auto& l, const auto& r ) { return l.timeAlloc < r; } );
|
auto ait = std::lower_bound( mem.data.begin(), mem.data.end(), ev.start, [] ( const auto& l, const auto& r ) { return l.timeAlloc < r; } );
|
||||||
const auto aend = std::upper_bound( mem.data.begin(), mem.data.end(), end, [] ( const auto& l, const auto& r ) { return l < r.timeAlloc; } );
|
const auto aend = std::upper_bound( mem.data.begin(), mem.data.end(), end, [] ( const auto& l, const auto& r ) { return l < r.timeAlloc; } );
|
||||||
|
|
||||||
@ -2692,29 +2694,45 @@ void View::DrawZoneInfoWindow()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ImGui::Text( "%s memory events.", RealToString( aDist + fDist, true ) );
|
|
||||||
|
|
||||||
int64_t change = 0;
|
int64_t change = 0;
|
||||||
int64_t cAlloc = 0;
|
int64_t cAlloc = 0;
|
||||||
int64_t cFree = 0;
|
int64_t cFree = 0;
|
||||||
|
int64_t nAlloc = 0;
|
||||||
|
int64_t nFree = 0;
|
||||||
|
|
||||||
while( ait != aend )
|
while( ait != aend )
|
||||||
{
|
{
|
||||||
change += ait->size;
|
if( ait->threadAlloc == thread )
|
||||||
cAlloc += ait->size;
|
{
|
||||||
|
change += ait->size;
|
||||||
|
cAlloc += ait->size;
|
||||||
|
nAlloc++;
|
||||||
|
}
|
||||||
ait++;
|
ait++;
|
||||||
}
|
}
|
||||||
while( fit != fend )
|
while( fit != fend )
|
||||||
{
|
{
|
||||||
change -= mem.data[*fit].size;
|
if( mem.data[*fit].threadFree == thread )
|
||||||
cFree += mem.data[*fit].size;
|
{
|
||||||
|
change -= mem.data[*fit].size;
|
||||||
|
cFree += mem.data[*fit].size;
|
||||||
|
nFree++;
|
||||||
|
}
|
||||||
fit++;
|
fit++;
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui::Text( "%s allocs, %s frees.", RealToString( aDist, true ), RealToString( fDist, true ) );
|
if( nAlloc == 0 && nFree == 0 )
|
||||||
ImGui::Text( "Memory allocated: %s bytes", RealToString( cAlloc, true ) );
|
{
|
||||||
ImGui::Text( "Memory freed: %s bytes", RealToString( cFree, true ) );
|
ImGui::Text( "No memory events." );
|
||||||
ImGui::Text( "Overall change: %s bytes", RealToString( change, true ) );
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ImGui::Text( "%s memory events.", RealToString( nAlloc + nFree, true ) );
|
||||||
|
ImGui::Text( "%s allocs, %s frees.", RealToString( nAlloc, true ), RealToString( nFree, true ) );
|
||||||
|
ImGui::Text( "Memory allocated: %s bytes", RealToString( cAlloc, true ) );
|
||||||
|
ImGui::Text( "Memory freed: %s bytes", RealToString( cFree, true ) );
|
||||||
|
ImGui::Text( "Overall change: %s bytes", RealToString( change, true ) );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user