mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-10 10:41:50 +00:00
Clip memory allocation lists.
This commit is contained in:
parent
a84eec1aef
commit
d680fa6cd6
@ -6200,7 +6200,7 @@ void View::DrawZoneInfoWindow()
|
||||
}
|
||||
pdqsort_branchless( v.begin(), v.end(), [] ( const auto& l, const auto& r ) { return l->TimeAlloc() < r->TimeAlloc(); } );
|
||||
|
||||
ListMemData<decltype( v.begin() )>( v.begin(), v.end(), []( auto& v ) {
|
||||
ListMemData<decltype( v.begin() )>( v.begin(), v.end(), []( auto v ) {
|
||||
ImGui::Text( "0x%" PRIx64, (*v)->Ptr() );
|
||||
}, nullptr, m_allocTimeRelativeToZone ? ev.Start() : -1 );
|
||||
ImGui::TreePop();
|
||||
@ -12572,7 +12572,7 @@ void View::DrawAnnotationList()
|
||||
}
|
||||
|
||||
template<class T>
|
||||
void View::ListMemData( T ptr, T end, std::function<void(T&)> DrawAddress, const char* id, int64_t startTime )
|
||||
void View::ListMemData( T ptr, T end, std::function<void(T)> DrawAddress, const char* id, int64_t startTime )
|
||||
{
|
||||
if( startTime == -1 ) startTime = 0;
|
||||
|
||||
@ -12613,20 +12613,23 @@ void View::ListMemData( T ptr, T end, std::function<void(T&)> DrawAddress, const
|
||||
const auto& mem = m_worker.GetMemData();
|
||||
|
||||
int idx = 0;
|
||||
while( ptr != end )
|
||||
ImGuiListClipper clipper( end - ptr );
|
||||
while( clipper.Step() )
|
||||
{
|
||||
auto v = *ptr;
|
||||
for( auto i=clipper.DisplayStart; i<clipper.DisplayEnd; i++ )
|
||||
{
|
||||
auto v = ptr[i];
|
||||
const auto arrIdx = std::distance( mem.data.begin(), v );
|
||||
|
||||
if( m_memoryAllocInfoWindow == arrIdx )
|
||||
{
|
||||
ImGui::PushStyleColor( ImGuiCol_Text, ImVec4( 1.f, 0.f, 0.f, 1.f ) );
|
||||
DrawAddress( ptr );
|
||||
DrawAddress( ptr+i );
|
||||
ImGui::PopStyleColor();
|
||||
}
|
||||
else
|
||||
{
|
||||
DrawAddress( ptr );
|
||||
DrawAddress( ptr+i );
|
||||
if( ImGui::IsItemClicked() )
|
||||
{
|
||||
m_memoryAllocInfoWindow = arrIdx;
|
||||
@ -12785,7 +12788,7 @@ void View::ListMemData( T ptr, T end, std::function<void(T&)> DrawAddress, const
|
||||
SmallCallstackButton( "free", v->csFree.Val(), idx );
|
||||
}
|
||||
ImGui::NextColumn();
|
||||
ptr++;
|
||||
}
|
||||
}
|
||||
ImGui::EndColumns();
|
||||
ImGui::EndChild();
|
||||
@ -13232,7 +13235,7 @@ void View::DrawMemory()
|
||||
}
|
||||
else
|
||||
{
|
||||
ListMemData<decltype( match.begin() )>( match.begin(), match.end(), [this]( auto& it ) {
|
||||
ListMemData<decltype( match.begin() )>( match.begin(), match.end(), [this]( auto it ) {
|
||||
auto& v = *it;
|
||||
if( v->Ptr() == m_memInfo.ptrFind )
|
||||
{
|
||||
@ -13289,7 +13292,7 @@ void View::DrawMemory()
|
||||
|
||||
if( !items.empty() )
|
||||
{
|
||||
ListMemData<decltype( items.begin() )>( items.begin(), items.end(), []( auto& v ) {
|
||||
ListMemData<decltype( items.begin() )>( items.begin(), items.end(), []( auto v ) {
|
||||
ImGui::Text( "0x%" PRIx64, (*v)->Ptr() );
|
||||
}, "##activeMem" );
|
||||
}
|
||||
@ -13559,7 +13562,7 @@ void View::DrawAllocList()
|
||||
ImGui::SetNextWindowSize( ImVec2( 1100, 500 ), ImGuiCond_FirstUseEver );
|
||||
ImGui::Begin( "Allocations list", &m_memInfo.showAllocList );
|
||||
TextFocused( "Number of allocations:", RealToString( m_memInfo.allocList.size() ) );
|
||||
ListMemData<decltype( data.begin() )>( data.begin(), data.end(), []( auto& v ) {
|
||||
ListMemData<decltype( data.begin() )>( data.begin(), data.end(), []( auto v ) {
|
||||
ImGui::Text( "0x%" PRIx64, (*v)->Ptr() );
|
||||
}, "##allocations" );
|
||||
ImGui::End();
|
||||
|
@ -154,7 +154,7 @@ private:
|
||||
void DrawAnnotationList();
|
||||
|
||||
template<class T>
|
||||
void ListMemData( T ptr, T end, std::function<void(T&)> DrawAddress, const char* id = nullptr, int64_t startTime = -1 );
|
||||
void ListMemData( T ptr, T end, std::function<void(T)> DrawAddress, const char* id = nullptr, int64_t startTime = -1 );
|
||||
|
||||
unordered_flat_map<uint32_t, PathData> GetCallstackPaths( const MemData& mem, bool onlyActive ) const;
|
||||
unordered_flat_map<uint64_t, CallstackFrameTree> GetCallstackFrameTreeBottomUp( const MemData& mem ) const;
|
||||
|
Loading…
Reference in New Issue
Block a user