Allow hiding "[unknown frames]" entries.

This commit is contained in:
Bartosz Taudul 2018-12-21 21:10:29 +01:00
parent e9ce8fdfda
commit cd8d86edf3
2 changed files with 17 additions and 5 deletions

View File

@ -325,6 +325,7 @@ View::View( const char* addr, ImFont* fixedWidth, SetTitleCallback stcb )
, m_statSort( 0 )
, m_statSelf( false )
, m_showCallstackFrameAddress( false )
, m_showUnknownFrames( true )
, m_namespace( Namespace::Full )
, m_textEditorFont( fixedWidth )
, m_stcb( stcb )
@ -373,6 +374,7 @@ View::View( FileRead& f, ImFont* fixedWidth, SetTitleCallback stcb )
, m_statSort( 0 )
, m_statSelf( false )
, m_showCallstackFrameAddress( false )
, m_showUnknownFrames( true )
, m_namespace( Namespace::Full )
, m_textEditorFont( fixedWidth )
, m_stcb( stcb )
@ -3566,13 +3568,16 @@ void View::DrawInfoWindow()
}
template<typename T>
void DrawZoneTrace( T zone, const std::vector<T>& trace, const Worker& worker, BuzzAnim<const void*>& anim, View& view, std::function<void(T)> showZone )
void DrawZoneTrace( T zone, const std::vector<T>& trace, const Worker& worker, BuzzAnim<const void*>& anim, View& view, bool& showUnknownFrames, std::function<void(T)> showZone )
{
bool expand = ImGui::TreeNode( "Zone trace" );
ImGui::SameLine();
ImGui::TextDisabled( "(%s)", RealToString( trace.size(), true ) );
if( !expand ) return;
ImGui::SameLine();
if( ImGui::SmallButton( showUnknownFrames ? "Hide unknown frames" : "Show unknown frames" ) ) showUnknownFrames = !showUnknownFrames;
if( !trace.empty() )
{
T prev = zone;
@ -3582,7 +3587,10 @@ void DrawZoneTrace( T zone, const std::vector<T>& trace, const Worker& worker, B
auto curr = trace[i];
if( prev->callstack == 0 || curr->callstack == 0 )
{
ImGui::TextDisabled( "[unknown frames]" );
if( showUnknownFrames )
{
ImGui::TextDisabled( "[unknown frames]" );
}
}
else if( prev->callstack != curr->callstack )
{
@ -3653,7 +3661,10 @@ void DrawZoneTrace( T zone, const std::vector<T>& trace, const Worker& worker, B
auto last = trace.empty() ? zone : trace.back();
if( last->callstack == 0 )
{
ImGui::TextDisabled( "[unknown frames]" );
if( showUnknownFrames )
{
ImGui::TextDisabled( "[unknown frames]" );
}
}
else
{
@ -3953,7 +3964,7 @@ void View::DrawZoneInfoWindow()
parent = GetZoneParent( *parent );
}
int idx = 0;
DrawZoneTrace<const ZoneEvent*>( &ev, zoneTrace, m_worker, m_zoneinfoBuzzAnim, *this, [&idx, this] ( const ZoneEvent* v ) {
DrawZoneTrace<const ZoneEvent*>( &ev, zoneTrace, m_worker, m_zoneinfoBuzzAnim, *this, m_showUnknownFrames, [&idx, this] ( const ZoneEvent* v ) {
const auto& srcloc = m_worker.GetSourceLocation( v->srcloc );
const auto txt = m_worker.GetZoneName( *v, srcloc );
ImGui::PushID( idx++ );
@ -4200,7 +4211,7 @@ void View::DrawGpuInfoWindow()
parent = GetZoneParent( *parent );
}
int idx = 0;
DrawZoneTrace<const GpuEvent*>( &ev, zoneTrace, m_worker, m_zoneinfoBuzzAnim, *this, [&idx, this] ( const GpuEvent* v ) {
DrawZoneTrace<const GpuEvent*>( &ev, zoneTrace, m_worker, m_zoneinfoBuzzAnim, *this, m_showUnknownFrames, [&idx, this] ( const GpuEvent* v ) {
const auto& srcloc = m_worker.GetSourceLocation( v->srcloc );
const auto txt = m_worker.GetZoneName( *v, srcloc );
ImGui::PushID( idx++ );

View File

@ -254,6 +254,7 @@ private:
int m_statSort;
bool m_statSelf;
bool m_showCallstackFrameAddress;
bool m_showUnknownFrames;
Namespace m_namespace;
Animation m_zoomAnim;