Add allocations list window.

This commit is contained in:
Bartosz Taudul 2018-09-27 23:16:10 +02:00
parent 01e0bbb5f9
commit 6cfd53b274
2 changed files with 15 additions and 1 deletions

View File

@ -695,6 +695,7 @@ bool View::DrawImpl()
if( m_findZone.show ) DrawFindZone();
if( m_showStatistics ) DrawStatistics();
if( m_memInfo.show ) DrawMemory();
if( m_memInfo.showAllocList ) DrawAllocList();
if( m_compare.show ) DrawCompare();
if( m_callstackInfoWindow != 0 ) DrawCallstackWindow();
if( m_memoryAllocInfoWindow >= 0 ) DrawMemoryAllocWindow();
@ -7517,7 +7518,7 @@ void View::DrawMemory()
#endif
{
ImGui::TextDisabled( "Press ctrl key to display allocation info tooltip." );
ImGui::TextDisabled( "Right click on file name to open source file." );
ImGui::TextDisabled( "Right click on function name to display allocations list. Right click on file name to open source file." );
auto& mem = m_worker.GetMemData();
auto tree = GetCallstackFrameTree( mem );
@ -7566,6 +7567,7 @@ void View::DrawFrameTreeLevel( std::vector<CallstackFrameTree>& tree, int& idx )
{
auto& mem = m_worker.GetMemData().data;
const auto sz = mem.size();
m_memInfo.showAllocList = true;
m_memInfo.allocList.clear();
for( size_t i=0; i<sz; i++ )
{
@ -7666,6 +7668,16 @@ void View::DrawFrameTreeLevel( std::vector<CallstackFrameTree>& tree, int& idx )
}
}
void View::DrawAllocList()
{
ImGui::Begin( "Allocations list", &m_memInfo.showAllocList );
TextFocused( "Number of allocations:", RealToString( m_memInfo.allocList.size(), true ) );
ListMemData<decltype( m_memInfo.allocList.begin() )>( m_memInfo.allocList.begin(), m_memInfo.allocList.end(), [this]( auto& v ) {
ImGui::Text( "0x%" PRIx64, (*v)->ptr );
}, "##allocations" );
ImGui::End();
}
std::pair<int8_t*, size_t> View::GetMemoryPages() const
{
const auto& mem = m_worker.GetMemData();

View File

@ -93,6 +93,7 @@ private:
void DrawFindZone();
void DrawStatistics();
void DrawMemory();
void DrawAllocList();
void DrawCompare();
void DrawCallstackWindow();
void DrawMemoryAllocWindow();
@ -402,6 +403,7 @@ private:
char pattern[1024] = {};
uint64_t ptrFind = 0;
bool restrictTime = false;
bool showAllocList = false;
std::vector<const MemEvent*> allocList;
} m_memInfo;