mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-10 02:31:48 +00:00
Allow listing cached source files.
This commit is contained in:
parent
c507507233
commit
b0d71b648f
@ -12630,12 +12630,39 @@ void View::DrawInfo()
|
||||
ImGui::TextUnformatted( "Coarse CPU core context switch data" );
|
||||
ImGui::EndTooltip();
|
||||
}
|
||||
TextFocused( "Source file cache:", RealToString( m_worker.GetSourceFileCacheCount() ) );
|
||||
if( ImGui::IsItemHovered() )
|
||||
if( m_worker.GetSourceFileCacheCount() == 0 )
|
||||
{
|
||||
ImGui::BeginTooltip();
|
||||
ImGui::TextUnformatted( MemSizeToString( m_worker.GetSourceFileCacheSize() ) );
|
||||
ImGui::EndTooltip();
|
||||
TextFocused( "Source file cache:", "0" );
|
||||
}
|
||||
else
|
||||
{
|
||||
ImGui::PushStyleColor( ImGuiCol_Text, GImGui->Style.Colors[ImGuiCol_TextDisabled] );
|
||||
const bool expand = ImGui::TreeNode( "Source file cache:" );
|
||||
ImGui::PopStyleColor();
|
||||
ImGui::SameLine();
|
||||
ImGui::TextUnformatted( RealToString( m_worker.GetSourceFileCacheCount() ) );
|
||||
if( ImGui::IsItemHovered() )
|
||||
{
|
||||
ImGui::BeginTooltip();
|
||||
ImGui::TextUnformatted( MemSizeToString( m_worker.GetSourceFileCacheSize() ) );
|
||||
ImGui::EndTooltip();
|
||||
}
|
||||
if( expand )
|
||||
{
|
||||
auto& cache = m_worker.GetSourceFileCache();
|
||||
std::vector<decltype(cache.begin())> vec;
|
||||
vec.reserve( cache.size() );
|
||||
for( auto it = cache.begin(); it != cache.end(); ++it ) vec.emplace_back( it );
|
||||
pdqsort_branchless( vec.begin(), vec.end(), []( const auto& lhs, const auto& rhs ) { return strcmp( lhs->first, rhs->first ) < 0; } );
|
||||
for( auto& v : vec )
|
||||
{
|
||||
ImGui::BulletText( v->first );
|
||||
if( ImGui::IsItemClicked() ) ViewSource( v->first, 0 );
|
||||
ImGui::SameLine();
|
||||
ImGui::TextDisabled( "(%s)", MemSizeToString( v->second.len ) );
|
||||
}
|
||||
ImGui::TreePop();
|
||||
}
|
||||
}
|
||||
ImGui::TreePop();
|
||||
}
|
||||
|
@ -457,6 +457,7 @@ public:
|
||||
uint64_t GetPidFromTid( uint64_t tid ) const;
|
||||
const unordered_flat_map<uint64_t, CpuThreadData>& GetCpuThreadData() const { return m_data.cpuThreadData; }
|
||||
void GetCpuUsageAtTime( int64_t time, int& own, int& other ) const;
|
||||
const unordered_flat_map<const char*, MemoryBlock, charutil::Hasher, charutil::Comparator>& GetSourceFileCache() const { return m_data.sourceFileCache; }
|
||||
uint64_t GetSourceFileCacheCount() const { return m_data.sourceFileCache.size(); }
|
||||
uint64_t GetSourceFileCacheSize() const;
|
||||
MemoryBlock GetSourceFileFromCache( const char* file ) const;
|
||||
|
Loading…
Reference in New Issue
Block a user