Allow custom time offset in memory allocation list.

This commit is contained in:
Bartosz Taudul 2019-03-17 16:47:44 +01:00
parent f0aadfe066
commit d2cca5dc3f
2 changed files with 5 additions and 3 deletions

View File

@ -8653,8 +8653,10 @@ void View::DrawLockInfoWindow()
}
template<class T>
void View::ListMemData( T ptr, T end, std::function<void(T&)> DrawAddress, const char* id )
void View::ListMemData( T ptr, T end, std::function<void(T&)> DrawAddress, const char* id, int64_t startTime )
{
if( startTime == -1 ) startTime = m_worker.GetTimeBegin();
const auto& style = ImGui::GetStyle();
const auto dist = std::distance( ptr, end ) + 1;
const auto ty = ImGui::GetTextLineHeight() + style.ItemSpacing.y;
@ -8724,7 +8726,7 @@ void View::ListMemData( T ptr, T end, std::function<void(T&)> DrawAddress, const
ImGui::TextUnformatted( MemSizeToString( v->size ) );
ImGui::NextColumn();
ImGui::PushID( idx++ );
if( ImGui::Selectable( TimeToString( v->timeAlloc - m_worker.GetTimeBegin() ) ) )
if( ImGui::Selectable( TimeToString( v->timeAlloc - startTime ) ) )
{
CenterAtTime( v->timeAlloc );
}

View File

@ -125,7 +125,7 @@ private:
void DrawLockInfoWindow();
template<class T>
void ListMemData( T ptr, T end, std::function<void(T&)> DrawAddress, const char* id = nullptr );
void ListMemData( T ptr, T end, std::function<void(T&)> DrawAddress, const char* id = nullptr, int64_t startTime = -1 );
flat_hash_map<uint32_t, PathData, nohash<uint32_t>> GetCallstackPaths( const MemData& mem ) const;
std::vector<CallstackFrameTree> GetCallstackFrameTreeBottomUp( const MemData& mem ) const;