1
0
mirror of https://github.com/wolfpld/tracy synced 2025-04-29 12:23:53 +00:00

Don't perform any work in collapsed windows.

This commit is contained in:
Bartosz Taudul 2021-11-22 01:15:22 +01:00
parent 9b1b56de26
commit 6c08943e66
No known key found for this signature in database
GPG Key ID: B7FE2008B7575DF3

View File

@ -7269,7 +7269,8 @@ void View::DrawZoneInfoWindow()
ImGui::SetNextWindowSize( ImVec2( 500 * scale, 600 * scale ), ImGuiCond_FirstUseEver );
bool show = true;
ImGui::Begin( "Zone info", &show, ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoScrollWithMouse );
if( !ImGui::GetCurrentWindowRead()->SkipItems )
{
if( ImGui::Button( ICON_FA_MICROSCOPE " Zoom to zone" ) )
{
ZoomToZone( ev );
@ -8087,6 +8088,7 @@ void View::DrawZoneInfoWindow()
}
ImGui::EndChild();
}
ImGui::End();
if( !show )
@ -8336,7 +8338,8 @@ void View::DrawGpuInfoWindow()
ImGui::SetNextWindowSize( ImVec2( 500 * scale, 600 * scale), ImGuiCond_FirstUseEver );
bool show = true;
ImGui::Begin( "Zone info", &show, ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoScrollWithMouse );
if( !ImGui::GetCurrentWindowRead()->SkipItems )
{
if( ImGui::Button( ICON_FA_MICROSCOPE " Zoom to zone" ) )
{
ZoomToZone( ev );
@ -8541,6 +8544,7 @@ void View::DrawGpuInfoWindow()
}
ImGui::EndChild();
}
ImGui::End();
if( !show )
@ -8765,6 +8769,7 @@ void View::DrawGpuInfoChildren( const V& children, int64_t ztime )
void View::DrawOptions()
{
ImGui::Begin( "Options", &m_showOptions, ImGuiWindowFlags_AlwaysAutoResize );
if( ImGui::GetCurrentWindowRead()->SkipItems ) { ImGui::End(); return; }
const auto scale = GetScale();
bool val = m_vd.drawEmptyLabels;
@ -9472,6 +9477,7 @@ void View::DrawMessages()
const auto scale = GetScale();
ImGui::SetNextWindowSize( ImVec2( 1200 * scale, 600 * scale ), ImGuiCond_FirstUseEver );
ImGui::Begin( "Messages", &m_showMessages );
if( ImGui::GetCurrentWindowRead()->SkipItems ) { ImGui::End(); return; }
if( msgs.empty() )
{
@ -9827,6 +9833,7 @@ void View::DrawFindZone()
const auto scale = GetScale();
ImGui::SetNextWindowSize( ImVec2( 520 * scale, 800 * scale ), ImGuiCond_FirstUseEver );
ImGui::Begin( "Find zone", &m_findZone.show, ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoScrollWithMouse );
if( ImGui::GetCurrentWindowRead()->SkipItems ) { ImGui::End(); return; }
#ifdef TRACY_NO_STATISTICS
ImGui::TextWrapped( "Collection of statistical data is disabled in this build." );
ImGui::TextWrapped( "Rebuild without the TRACY_NO_STATISTICS macro to enable zone search." );
@ -11746,6 +11753,7 @@ void View::DrawCompare()
const auto scale = GetScale();
ImGui::SetNextWindowSize( ImVec2( 590 * scale, 800 * scale ), ImGuiCond_FirstUseEver );
ImGui::Begin( "Compare traces", &m_compare.show, ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoScrollWithMouse );
if( ImGui::GetCurrentWindowRead()->SkipItems ) { ImGui::End(); return; }
#ifdef TRACY_NO_STATISTICS
ImGui::TextWrapped( "Collection of statistical data is disabled in this build." );
ImGui::TextWrapped( "Rebuild without the TRACY_NO_STATISTICS macro to enable trace comparison." );
@ -12722,6 +12730,7 @@ void View::DrawStatistics()
const auto scale = GetScale();
ImGui::SetNextWindowSize( ImVec2( 1400 * scale, 600 * scale ), ImGuiCond_FirstUseEver );
ImGui::Begin( "Statistics", &m_showStatistics, ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoScrollWithMouse );
if( ImGui::GetCurrentWindowRead()->SkipItems ) { ImGui::End(); return; }
#ifdef TRACY_NO_STATISTICS
ImGui::TextWrapped( "Collection of statistical data is disabled in this build." );
ImGui::TextWrapped( "Rebuild without the TRACY_NO_STATISTICS macro to enable statistics view." );
@ -13880,7 +13889,10 @@ void View::DrawCallstackWindow()
const auto scale = GetScale();
ImGui::SetNextWindowSize( ImVec2( 1400 * scale, 500 * scale ), ImGuiCond_FirstUseEver );
ImGui::Begin( "Call stack", &show, ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoScrollWithMouse );
if( !ImGui::GetCurrentWindowRead()->SkipItems )
{
DrawCallstackTable( m_callstackInfoWindow, true );
}
ImGui::End();
if( !show ) m_callstackInfoWindow = 0;
}
@ -14216,7 +14228,8 @@ void View::DrawMemoryAllocWindow()
{
bool show = true;
ImGui::Begin( "Memory allocation", &show, ImGuiWindowFlags_AlwaysAutoResize );
if( !ImGui::GetCurrentWindowRead()->SkipItems )
{
const auto& mem = m_worker.GetMemoryNamed( m_memoryAllocInfoPool );
const auto& ev = mem.data[m_memoryAllocInfoWindow];
const auto tidAlloc = m_worker.DecompressThread( ev.ThreadAlloc() );
@ -14348,21 +14361,17 @@ void View::DrawMemoryAllocWindow()
}
}
}
}
ImGui::End();
if( !show ) m_memoryAllocInfoWindow = -1;
}
void View::DrawInfo()
{
char dtmp[64];
time_t date = m_worker.GetCaptureTime();
auto lt = localtime( &date );
strftime( dtmp, 64, "%F %T", lt );
const auto scale = GetScale();
ImGui::SetNextWindowSize( ImVec2( 400 * scale, 650 * scale ), ImGuiCond_FirstUseEver );
ImGui::Begin( "Trace information", &m_showInfo, ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoScrollWithMouse );
if( ImGui::GetCurrentWindowRead()->SkipItems ) { ImGui::End(); return; }
if( m_bigFont ) ImGui::PushFont( m_bigFont );
TextFocused( "Program:", m_worker.GetCaptureProgram().c_str() );
if( m_bigFont ) ImGui::PopFont();
@ -14375,7 +14384,13 @@ void View::DrawInfo()
strftime( etmp, 64, "%F %T", elt );
TextFocused( "Build time:", etmp );
}
{
char dtmp[64];
time_t date = m_worker.GetCaptureTime();
auto lt = localtime( &date );
strftime( dtmp, 64, "%F %T", lt );
TextFocused( "Capture time:", dtmp );
}
if( !m_filename.empty() )
{
TextFocused( "File:", m_filename.c_str() );
@ -15277,14 +15292,21 @@ void View::DrawTextEditor()
ImGui::SetNextWindowSize( ImVec2( 1800 * scale, 800 * scale ), ImGuiCond_FirstUseEver );
bool show = true;
ImGui::Begin( "Source view", &show, ImGuiWindowFlags_NoScrollbar );
if( !ImGui::GetCurrentWindowRead()->SkipItems )
{
m_sourceView->UpdateFont( m_fixedFont, m_smallFont );
m_sourceView->Render( m_worker, *this );
}
ImGui::End();
if( !show ) m_sourceViewFile = nullptr;
}
void View::DrawLockInfoWindow()
{
bool visible = true;
ImGui::Begin( "Lock info", &visible, ImGuiWindowFlags_AlwaysAutoResize );
if( !ImGui::GetCurrentWindowRead()->SkipItems )
{
auto it = m_worker.GetLockMap().find( m_lockInfoWindow );
assert( it != m_worker.GetLockMap().end() );
const auto& lock = *it->second;
@ -15353,8 +15375,6 @@ void View::DrawLockInfoWindow()
}
}
bool visible = true;
ImGui::Begin( "Lock info", &visible, ImGuiWindowFlags_AlwaysAutoResize );
if( m_bigFont ) ImGui::PushFont( m_bigFont );
if( lock.customName.Active() )
{
@ -15445,6 +15465,7 @@ void View::DrawLockInfoWindow()
}
ImGui::TreePop();
}
}
ImGui::End();
if( !visible ) m_lockInfoWindow = InvalidId;
}
@ -15478,6 +15499,10 @@ enum { PlaybackWindowButtonsCount = sizeof( PlaybackWindowButtons ) / sizeof( *P
void View::DrawPlayback()
{
ImGui::Begin( "Playback", &m_showPlayback, ImGuiWindowFlags_AlwaysAutoResize );
if( !m_showPlayback ) m_playback.pause = true;
if( ImGui::GetCurrentWindowRead()->SkipItems ) { ImGui::End(); return; }
const auto scale = GetScale();
const auto frameSet = m_worker.GetFramesBase();
const auto& frameImages = m_worker.GetFrameImages();
@ -15521,11 +15546,6 @@ void View::DrawPlayback()
}
}
ImGui::Begin( "Playback", &m_showPlayback, ImGuiWindowFlags_AlwaysAutoResize );
if( !m_showPlayback )
{
m_playback.pause = true;
}
if( m_playback.zoom )
{
if( fi->flip )
@ -15660,6 +15680,11 @@ void View::DrawPlayback()
void View::DrawCpuDataWindow()
{
const auto scale = GetScale();
ImGui::SetNextWindowSize( ImVec2( 700 * scale, 800 * scale ), ImGuiCond_FirstUseEver );
ImGui::Begin( "CPU data", &m_showCpuDataWindow );
if( ImGui::GetCurrentWindowRead()->SkipItems ) { ImGui::End(); return; }
struct PidData
{
std::vector<uint64_t> tids;
@ -15682,9 +15707,6 @@ void View::DrawCpuDataWindow()
it->second.data.migrations += v.second.migrations;
}
const auto scale = GetScale();
ImGui::SetNextWindowSize( ImVec2( 700 * scale, 800 * scale ), ImGuiCond_FirstUseEver );
ImGui::Begin( "CPU data", &m_showCpuDataWindow );
TextFocused( "Tracked threads:", RealToString( ctd.size() ) );
ImGui::SameLine();
TextFocused( "Tracked processes:", RealToString( pids.size() ) );
@ -15960,6 +15982,8 @@ void View::DrawSelectedAnnotation()
assert( m_selectedAnnotation );
bool show = true;
ImGui::Begin( "Annotation", &show, ImGuiWindowFlags_AlwaysAutoResize );
if( !ImGui::GetCurrentWindowRead()->SkipItems )
{
if( ImGui::Button( ICON_FA_MICROSCOPE " Zoom to annotation" ) )
{
ZoomToRange( m_selectedAnnotation->range.min, m_selectedAnnotation->range.max );
@ -15998,6 +16022,7 @@ void View::DrawSelectedAnnotation()
TextFocused( "Annotation begin:", TimeToStringExact( m_selectedAnnotation->range.min ) );
TextFocused( "Annotation end:", TimeToStringExact( m_selectedAnnotation->range.max ) );
TextFocused( "Annotation length:", TimeToString( m_selectedAnnotation->range.max - m_selectedAnnotation->range.min ) );
}
ImGui::End();
if( !show ) m_selectedAnnotation = nullptr;
}
@ -16007,6 +16032,7 @@ void View::DrawAnnotationList()
const auto scale = GetScale();
ImGui::SetNextWindowSize( ImVec2( 600 * scale, 300 * scale ), ImGuiCond_FirstUseEver );
ImGui::Begin( "Annotation list", &m_showAnnotationList );
if( ImGui::GetCurrentWindowRead()->SkipItems ) { ImGui::End(); return; }
if( m_annotations.empty() )
{
ImGui::TextWrapped( "No annotations." );
@ -16072,14 +16098,16 @@ void View::DrawAnnotationList()
void View::DrawSampleParents()
{
const auto symbol = m_worker.GetSymbolData( m_sampleParents.symAddr );
const auto& stats = *m_worker.GetSymbolStats( m_sampleParents.symAddr );
assert( !stats.parents.empty() );
bool show = true;
const auto scale = GetScale();
ImGui::SetNextWindowSize( ImVec2( 1400 * scale, 500 * scale ), ImGuiCond_FirstUseEver );
ImGui::Begin( "Sample entry call stacks", &show, ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoScrollWithMouse );
if( !ImGui::GetCurrentWindowRead()->SkipItems )
{
const auto symbol = m_worker.GetSymbolData( m_sampleParents.symAddr );
const auto& stats = *m_worker.GetSymbolStats( m_sampleParents.symAddr );
assert( !stats.parents.empty() );
ImGui::PushFont( m_bigFont );
TextFocused( "Symbol:", m_worker.GetString( symbol->name ) );
if( symbol->isInline )
@ -16339,6 +16367,7 @@ void View::DrawSampleParents()
}
ImGui::EndTable();
}
}
ImGui::End();
if( !show )
@ -16350,6 +16379,7 @@ void View::DrawSampleParents()
void View::DrawRanges()
{
ImGui::Begin( "Time range limits", &m_showRanges, ImGuiWindowFlags_AlwaysAutoResize );
if( ImGui::GetCurrentWindowRead()->SkipItems ) { ImGui::End(); return; }
DrawRangeEntry( m_findZone.range, ICON_FA_SEARCH " Find zone", 0x4488DD88, "RangeFindZoneCopyFrom", 0 );
ImGui::Separator();
DrawRangeEntry( m_statRange, ICON_FA_SORT_AMOUNT_UP " Statistics", 0x448888EE, "RangeStatisticsCopyFrom", 1 );
@ -16427,6 +16457,7 @@ void View::DrawWaitStacks()
const auto scale = GetScale();
ImGui::SetNextWindowSize( ImVec2( 1400 * scale, 500 * scale ), ImGuiCond_FirstUseEver );
ImGui::Begin( "Wait stacks", &m_showWaitStacks );
if( ImGui::GetCurrentWindowRead()->SkipItems ) { ImGui::End(); return; }
#ifdef TRACY_NO_STATISTICS
ImGui::TextWrapped( "Rebuild without the TRACY_NO_STATISTICS macro to enable wait stacks." );
#else
@ -17321,6 +17352,7 @@ void View::DrawMemory()
const auto scale = GetScale();
ImGui::SetNextWindowSize( ImVec2( 1100 * scale, 500 * scale ), ImGuiCond_FirstUseEver );
ImGui::Begin( "Memory", &m_memInfo.show, ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoScrollWithMouse );
if( ImGui::GetCurrentWindowRead()->SkipItems ) { ImGui::End(); return; }
auto& memNameMap = m_worker.GetMemNameMap();
if( memNameMap.size() > 1 )
@ -17862,6 +17894,11 @@ void View::DrawFrameTreeLevel( const unordered_flat_map<uint64_t, CallstackFrame
void View::DrawAllocList()
{
const auto scale = GetScale();
ImGui::SetNextWindowSize( ImVec2( 1100 * scale, 500 * scale ), ImGuiCond_FirstUseEver );
ImGui::Begin( "Allocations list", &m_memInfo.showAllocList );
if( ImGui::GetCurrentWindowRead()->SkipItems ) { ImGui::End(); return; }
std::vector<const MemEvent*> data;
auto basePtr = m_worker.GetMemoryNamed( m_memInfo.pool ).data.data();
data.reserve( m_memInfo.allocList.size() );
@ -17870,9 +17907,6 @@ void View::DrawAllocList()
data.emplace_back( basePtr + idx );
}
const auto scale = GetScale();
ImGui::SetNextWindowSize( ImVec2( 1100 * scale, 500 * scale ), ImGuiCond_FirstUseEver );
ImGui::Begin( "Allocations list", &m_memInfo.showAllocList );
TextFocused( "Number of allocations:", RealToString( m_memInfo.allocList.size() ) );
ListMemData( data, []( auto v ) {
ImGui::Text( "0x%" PRIx64, v->Ptr() );