mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-22 22:44:34 +00:00
Add basic zone info window.
This commit is contained in:
parent
a8c219dd88
commit
c5f6ca9656
@ -42,6 +42,7 @@ View::View( const char* addr )
|
||||
, m_frameStart( 0 )
|
||||
, m_zvStart( 0 )
|
||||
, m_zvEnd( 0 )
|
||||
, m_zoneInfoWindow( nullptr )
|
||||
{
|
||||
assert( s_instance == nullptr );
|
||||
s_instance = this;
|
||||
@ -742,6 +743,7 @@ void View::DrawImpl()
|
||||
ImGui::Text( "Frames: %-7" PRIu64 " Time span: %-10s View span: %-10s Zones: %-10" PRIu64" Queue delay: %s Timer resolution: %s", m_frames.size(), TimeToString( GetLastTime() - m_frames[0] ), TimeToString( m_zvEnd - m_zvStart ), m_zonesCnt, TimeToString( m_delay ), TimeToString( m_resolution ) );
|
||||
DrawFrames();
|
||||
DrawZones();
|
||||
DrawZoneInfoWindow();
|
||||
ImGui::End();
|
||||
}
|
||||
|
||||
@ -1243,6 +1245,10 @@ int View::DrawZoneLevel( const Vector<Event*>& vec, bool hover, double pxns, con
|
||||
m_zvStartNext = ev.start;
|
||||
m_zvEndNext = ev.end;
|
||||
}
|
||||
if( ImGui::IsMouseClicked( 0 ) )
|
||||
{
|
||||
m_zoneInfoWindow = &ev;
|
||||
}
|
||||
}
|
||||
|
||||
if( !ev.child.empty() )
|
||||
@ -1258,4 +1264,25 @@ int View::DrawZoneLevel( const Vector<Event*>& vec, bool hover, double pxns, con
|
||||
return maxdepth;
|
||||
}
|
||||
|
||||
void View::DrawZoneInfoWindow()
|
||||
{
|
||||
if( !m_zoneInfoWindow ) return;
|
||||
auto& ev = *m_zoneInfoWindow;
|
||||
bool show = true;
|
||||
ImGui::Begin( "Zone info", &show, ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_ShowBorders );
|
||||
if( ev.text && ev.text->zoneName )
|
||||
{
|
||||
ImGui::Text( "Zone name: %s", GetString( ev.text->zoneName ) );
|
||||
}
|
||||
auto& srcloc = GetSourceLocation( ev.srcloc );
|
||||
ImGui::Text( "Function: %s", GetString( srcloc.function ) );
|
||||
ImGui::Text( "Location: %s:%i", GetString( srcloc.file ), srcloc.line );
|
||||
if( ev.text && ev.text->userText )
|
||||
{
|
||||
ImGui::Text( "User text: %s", ev.text->userText );
|
||||
}
|
||||
ImGui::End();
|
||||
if( !show ) m_zoneInfoWindow = nullptr;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -85,6 +85,7 @@ private:
|
||||
void DrawFrames();
|
||||
void DrawZones();
|
||||
int DrawZoneLevel( const Vector<Event*>& vec, bool hover, double pxns, const ImVec2& wpos, int offset, int depth );
|
||||
void DrawZoneInfoWindow();
|
||||
|
||||
std::string m_addr;
|
||||
|
||||
@ -135,6 +136,8 @@ private:
|
||||
uint64_t m_delay;
|
||||
uint64_t m_resolution;
|
||||
double m_timerMul;
|
||||
|
||||
const Event* m_zoneInfoWindow;
|
||||
};
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user