1
0
mirror of https://github.com/wolfpld/tracy.git synced 2025-03-20 07:40:02 +08:00

Extract call stack calls drawing functionality.

This commit is contained in:
Bartosz Taudul 2019-11-15 19:59:13 +01:00
parent a518564006
commit 973fd941d5
2 changed files with 31 additions and 25 deletions

View File

@ -7787,31 +7787,7 @@ void View::DrawMessages()
SmallCallstackButton( "Show", cs, idx );
#endif
ImGui::SameLine();
const auto& csdata = m_worker.GetCallstack( cs );
const auto cssz = std::min<int>( csdata.size(), 4 );
bool first = true;
for( int i=0; i<cssz; i++ )
{
const auto frameData = m_worker.GetCallstackFrame( csdata[i] );
if( !frameData ) break;
if( first )
{
first = false;
}
else
{
ImGui::SameLine();
#ifdef TRACY_EXTENDED_FONT
TextDisabledUnformatted( ICON_FA_LONG_ARROW_ALT_LEFT );
#else
TextDisabledUnformatted( "<-" );
#endif
ImGui::SameLine();
}
const auto& frame = frameData->data[frameData->size - 1];
auto txt = m_worker.GetString( frame.name );
ImGui::TextUnformatted( txt );
}
DrawCallstackCalls( cs, 4 );
}
ImGui::NextColumn();
msgcnt++;
@ -13967,6 +13943,35 @@ void View::SmallCallstackButton( const char* name, uint32_t callstack, int& idx,
}
}
void View::DrawCallstackCalls( uint32_t callstack, uint8_t limit ) const
{
const auto& csdata = m_worker.GetCallstack( callstack );
const auto cssz = std::min( csdata.size(), limit );
bool first = true;
for( uint8_t i=0; i<cssz; i++ )
{
const auto frameData = m_worker.GetCallstackFrame( csdata[i] );
if( !frameData ) break;
if( first )
{
first = false;
}
else
{
ImGui::SameLine();
#ifdef TRACY_EXTENDED_FONT
TextDisabledUnformatted( ICON_FA_LONG_ARROW_ALT_LEFT );
#else
TextDisabledUnformatted( "<-" );
#endif
ImGui::SameLine();
}
const auto& frame = frameData->data[frameData->size - 1];
auto txt = m_worker.GetString( frame.name );
ImGui::TextUnformatted( txt );
}
}
void View::SetViewToLastFrames()
{
const int total = m_worker.GetFrameCount( *m_frames );

View File

@ -222,6 +222,7 @@ private:
const char* GetPlotName( const PlotData* plot ) const;
void SmallCallstackButton( const char* name, uint32_t callstack, int& idx, bool tooltip = true );
void DrawCallstackCalls( uint32_t callstack, uint8_t limit ) const;
void SetViewToLastFrames();
int64_t GetZoneChildTime( const ZoneEvent& zone );
int64_t GetZoneChildTime( const GpuEvent& zone );