mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-10 10:41:50 +00:00
Don't use Vector for memory pages storage.
Vector has POT data size and we know exactly how much is needed.
This commit is contained in:
parent
7266a979c3
commit
e5934b409a
@ -4798,8 +4798,8 @@ void View::DrawMemory()
|
|||||||
auto pages = GetMemoryPages();
|
auto pages = GetMemoryPages();
|
||||||
|
|
||||||
const int8_t empty[PageSize] = {};
|
const int8_t empty[PageSize] = {};
|
||||||
const auto sz = pages.size() / PageSize;
|
const auto sz = pages.second / PageSize;
|
||||||
auto pgptr = pages.data();
|
auto pgptr = pages.first;
|
||||||
const auto end = pgptr + sz * PageSize;
|
const auto end = pgptr + sz * PageSize;
|
||||||
size_t lines = sz;
|
size_t lines = sz;
|
||||||
while( pgptr != end )
|
while( pgptr != end )
|
||||||
@ -4826,7 +4826,7 @@ void View::DrawMemory()
|
|||||||
draw->AddRectFilled( wpos, wpos + ImVec2( PageSize, lines ), 0xFF444444 );
|
draw->AddRectFilled( wpos, wpos + ImVec2( PageSize, lines ), 0xFF444444 );
|
||||||
|
|
||||||
size_t line = 0;
|
size_t line = 0;
|
||||||
pgptr = pages.data();
|
pgptr = pages.first;
|
||||||
while( pgptr != end )
|
while( pgptr != end )
|
||||||
{
|
{
|
||||||
if( memcmp( empty, pgptr, PageSize ) == 0 )
|
if( memcmp( empty, pgptr, PageSize ) == 0 )
|
||||||
@ -4866,6 +4866,8 @@ void View::DrawMemory()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
delete[] pages.first;
|
||||||
|
|
||||||
ImGui::EndChild();
|
ImGui::EndChild();
|
||||||
ImGui::TreePop();
|
ImGui::TreePop();
|
||||||
}
|
}
|
||||||
@ -4873,16 +4875,15 @@ void View::DrawMemory()
|
|||||||
ImGui::End();
|
ImGui::End();
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector<int8_t> View::GetMemoryPages() const
|
std::pair<int8_t*, size_t> View::GetMemoryPages() const
|
||||||
{
|
{
|
||||||
Vector<int8_t> ret;
|
|
||||||
|
|
||||||
const auto& mem = m_worker.GetMemData();
|
const auto& mem = m_worker.GetMemData();
|
||||||
const auto span = mem.high - mem.low;
|
const auto span = mem.high - mem.low;
|
||||||
const auto pages = ( span / PageChunkSize ) + 1;
|
const auto pages = ( span / PageChunkSize ) + 1;
|
||||||
|
|
||||||
ret.reserve_and_use( pages * PageSize );
|
const auto datasz = pages * PageSize;
|
||||||
auto pgptr = ret.data();
|
int8_t* data = new int8_t[datasz];
|
||||||
|
auto pgptr = data;
|
||||||
memset( pgptr, 0, pages * PageSize );
|
memset( pgptr, 0, pages * PageSize );
|
||||||
|
|
||||||
const auto memlow = mem.low;
|
const auto memlow = mem.low;
|
||||||
@ -4940,7 +4941,7 @@ Vector<int8_t> View::GetMemoryPages() const
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return std::make_pair( data, datasz );
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* View::GetPlotName( const PlotData* plot ) const
|
const char* View::GetPlotName( const PlotData* plot ) const
|
||||||
|
@ -115,7 +115,7 @@ private:
|
|||||||
void FindZonesCompare();
|
void FindZonesCompare();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
Vector<int8_t> GetMemoryPages() const;
|
std::pair<int8_t*, size_t> GetMemoryPages() const;
|
||||||
const char* GetPlotName( const PlotData* plot ) const;
|
const char* GetPlotName( const PlotData* plot ) const;
|
||||||
|
|
||||||
flat_hash_map<const void*, bool, nohash<const void*>> m_visible;
|
flat_hash_map<const void*, bool, nohash<const void*>> m_visible;
|
||||||
|
Loading…
Reference in New Issue
Block a user