mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-22 22:44:34 +00:00
Verify source file modification time against capture time.
This commit is contained in:
parent
16a40f2e1f
commit
0f574b5547
@ -12,6 +12,16 @@ static inline bool FileExists( const char* fn )
|
|||||||
return stat( fn, &buf ) == 0 && ( buf.st_mode & S_IFREG ) != 0;
|
return stat( fn, &buf ) == 0 && ( buf.st_mode & S_IFREG ) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline bool SourceFileValid( const char* fn, uint64_t olderThan )
|
||||||
|
{
|
||||||
|
struct stat buf;
|
||||||
|
if( stat( fn, &buf ) == 0 && ( buf.st_mode & S_IFREG ) != 0 )
|
||||||
|
{
|
||||||
|
return buf.st_mtime < olderThan;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -4068,7 +4068,7 @@ void DrawZoneTrace( T zone, const std::vector<T>& trace, const Worker& worker, B
|
|||||||
}
|
}
|
||||||
if( ImGui::IsItemClicked( 1 ) )
|
if( ImGui::IsItemClicked( 1 ) )
|
||||||
{
|
{
|
||||||
if( frame->line != 0 && FileExists( fileName ) )
|
if( frame->line != 0 && SourceFileValid( fileName, worker.GetCaptureTime() ) )
|
||||||
{
|
{
|
||||||
view.SetTextEditorFile( fileName, frame->line );
|
view.SetTextEditorFile( fileName, frame->line );
|
||||||
}
|
}
|
||||||
@ -4129,7 +4129,7 @@ void DrawZoneTrace( T zone, const std::vector<T>& trace, const Worker& worker, B
|
|||||||
}
|
}
|
||||||
if( ImGui::IsItemClicked( 1 ) )
|
if( ImGui::IsItemClicked( 1 ) )
|
||||||
{
|
{
|
||||||
if( frame->line != 0 && FileExists( fileName ) )
|
if( frame->line != 0 && SourceFileValid( fileName, worker.GetCaptureTime() ) )
|
||||||
{
|
{
|
||||||
view.SetTextEditorFile( fileName, frame->line );
|
view.SetTextEditorFile( fileName, frame->line );
|
||||||
}
|
}
|
||||||
@ -4207,7 +4207,7 @@ void View::DrawZoneInfoWindow()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
const auto fileName = m_worker.GetString( srcloc.file );
|
const auto fileName = m_worker.GetString( srcloc.file );
|
||||||
if( FileExists( fileName ) )
|
if( SourceFileValid( fileName, m_worker.GetCaptureTime() ) )
|
||||||
{
|
{
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
bool hilite = m_textEditorFile == fileName;
|
bool hilite = m_textEditorFile == fileName;
|
||||||
@ -4496,7 +4496,7 @@ void View::DrawZoneInfoWindow()
|
|||||||
ImGui::PopID();
|
ImGui::PopID();
|
||||||
if( ImGui::IsItemClicked( 1 ) )
|
if( ImGui::IsItemClicked( 1 ) )
|
||||||
{
|
{
|
||||||
if( FileExists( fileName ) )
|
if( SourceFileValid( fileName, m_worker.GetCaptureTime() ) )
|
||||||
{
|
{
|
||||||
SetTextEditorFile( fileName, srcloc.line );
|
SetTextEditorFile( fileName, srcloc.line );
|
||||||
}
|
}
|
||||||
@ -4798,7 +4798,7 @@ void View::DrawGpuInfoWindow()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
const auto fileName = m_worker.GetString( srcloc.file );
|
const auto fileName = m_worker.GetString( srcloc.file );
|
||||||
if( FileExists( fileName ) )
|
if( SourceFileValid( fileName, m_worker.GetCaptureTime() ) )
|
||||||
{
|
{
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
bool hilite = m_textEditorFile == fileName;
|
bool hilite = m_textEditorFile == fileName;
|
||||||
@ -4902,7 +4902,7 @@ void View::DrawGpuInfoWindow()
|
|||||||
ImGui::PopID();
|
ImGui::PopID();
|
||||||
if( ImGui::IsItemClicked( 1 ) )
|
if( ImGui::IsItemClicked( 1 ) )
|
||||||
{
|
{
|
||||||
if( FileExists( fileName ) )
|
if( SourceFileValid( fileName, m_worker.GetCaptureTime() ) )
|
||||||
{
|
{
|
||||||
SetTextEditorFile( fileName, srcloc.line );
|
SetTextEditorFile( fileName, srcloc.line );
|
||||||
}
|
}
|
||||||
@ -5327,7 +5327,7 @@ void View::DrawOptions()
|
|||||||
ImGui::TextDisabled( "(%s) %s:%i", RealToString( l.second->timeline.size(), true ), fileName, sl.line );
|
ImGui::TextDisabled( "(%s) %s:%i", RealToString( l.second->timeline.size(), true ), fileName, sl.line );
|
||||||
if( ImGui::IsItemClicked( 1 ) )
|
if( ImGui::IsItemClicked( 1 ) )
|
||||||
{
|
{
|
||||||
if( FileExists( fileName ) )
|
if( SourceFileValid( fileName, m_worker.GetCaptureTime() ) )
|
||||||
{
|
{
|
||||||
SetTextEditorFile( fileName, sl.line );
|
SetTextEditorFile( fileName, sl.line );
|
||||||
}
|
}
|
||||||
@ -5394,7 +5394,7 @@ void View::DrawOptions()
|
|||||||
ImGui::TextDisabled( "(%s) %s:%i", RealToString( l.second->timeline.size(), true ), fileName, sl.line );
|
ImGui::TextDisabled( "(%s) %s:%i", RealToString( l.second->timeline.size(), true ), fileName, sl.line );
|
||||||
if( ImGui::IsItemClicked( 1 ) )
|
if( ImGui::IsItemClicked( 1 ) )
|
||||||
{
|
{
|
||||||
if( FileExists( fileName ) )
|
if( SourceFileValid( fileName, m_worker.GetCaptureTime() ) )
|
||||||
{
|
{
|
||||||
SetTextEditorFile( fileName, sl.line );
|
SetTextEditorFile( fileName, sl.line );
|
||||||
}
|
}
|
||||||
@ -5461,7 +5461,7 @@ void View::DrawOptions()
|
|||||||
ImGui::TextDisabled( "(%s) %s:%i", RealToString( l.second->timeline.size(), true ), fileName, sl.line );
|
ImGui::TextDisabled( "(%s) %s:%i", RealToString( l.second->timeline.size(), true ), fileName, sl.line );
|
||||||
if( ImGui::IsItemClicked( 1 ) )
|
if( ImGui::IsItemClicked( 1 ) )
|
||||||
{
|
{
|
||||||
if( FileExists( fileName ) )
|
if( SourceFileValid( fileName, m_worker.GetCaptureTime() ) )
|
||||||
{
|
{
|
||||||
SetTextEditorFile( fileName, sl.line );
|
SetTextEditorFile( fileName, sl.line );
|
||||||
}
|
}
|
||||||
@ -5922,7 +5922,7 @@ void View::DrawFindZone()
|
|||||||
ImGui::TextColored( ImVec4( 0.5, 0.5, 0.5, 1 ), "(%s) %s:%i", RealToString( zones.size(), true ), fileName, srcloc.line );
|
ImGui::TextColored( ImVec4( 0.5, 0.5, 0.5, 1 ), "(%s) %s:%i", RealToString( zones.size(), true ), fileName, srcloc.line );
|
||||||
if( ImGui::IsItemClicked( 1 ) )
|
if( ImGui::IsItemClicked( 1 ) )
|
||||||
{
|
{
|
||||||
if( FileExists( fileName ) )
|
if( SourceFileValid( fileName, m_worker.GetCaptureTime() ) )
|
||||||
{
|
{
|
||||||
SetTextEditorFile( fileName, srcloc.line );
|
SetTextEditorFile( fileName, srcloc.line );
|
||||||
}
|
}
|
||||||
@ -8023,7 +8023,7 @@ void View::DrawStatistics()
|
|||||||
ImGui::TextDisabled( "%s:%i", file, srcloc.line );
|
ImGui::TextDisabled( "%s:%i", file, srcloc.line );
|
||||||
if( ImGui::IsItemClicked( 1 ) )
|
if( ImGui::IsItemClicked( 1 ) )
|
||||||
{
|
{
|
||||||
if( FileExists( file ) )
|
if( SourceFileValid( file, m_worker.GetCaptureTime() ) )
|
||||||
{
|
{
|
||||||
SetTextEditorFile( file, srcloc.line );
|
SetTextEditorFile( file, srcloc.line );
|
||||||
}
|
}
|
||||||
@ -8195,7 +8195,7 @@ void View::DrawCallstackWindow()
|
|||||||
}
|
}
|
||||||
if( ImGui::IsItemClicked( 1 ) )
|
if( ImGui::IsItemClicked( 1 ) )
|
||||||
{
|
{
|
||||||
if( FileExists( txt ) )
|
if( SourceFileValid( txt, m_worker.GetCaptureTime() ) )
|
||||||
{
|
{
|
||||||
SetTextEditorFile( txt, frame.line );
|
SetTextEditorFile( txt, frame.line );
|
||||||
}
|
}
|
||||||
@ -9106,7 +9106,7 @@ void View::DrawLockInfoWindow()
|
|||||||
ImGui::Text( "%s:%i", fileName, srcloc.line );
|
ImGui::Text( "%s:%i", fileName, srcloc.line );
|
||||||
if( ImGui::IsItemClicked( 1 ) )
|
if( ImGui::IsItemClicked( 1 ) )
|
||||||
{
|
{
|
||||||
if( FileExists( fileName ) )
|
if( SourceFileValid( fileName, m_worker.GetCaptureTime() ) )
|
||||||
{
|
{
|
||||||
SetTextEditorFile( fileName, srcloc.line );
|
SetTextEditorFile( fileName, srcloc.line );
|
||||||
}
|
}
|
||||||
@ -10202,7 +10202,7 @@ void View::DrawFrameTreeLevel( const flat_hash_map<uint64_t, CallstackFrameTree,
|
|||||||
ImGui::TextDisabled( "%s:%i", fileName, frame.line );
|
ImGui::TextDisabled( "%s:%i", fileName, frame.line );
|
||||||
if( ImGui::IsItemClicked( 1 ) )
|
if( ImGui::IsItemClicked( 1 ) )
|
||||||
{
|
{
|
||||||
if( FileExists( fileName ) )
|
if( SourceFileValid( fileName, m_worker.GetCaptureTime() ) )
|
||||||
{
|
{
|
||||||
SetTextEditorFile( fileName, frame.line );
|
SetTextEditorFile( fileName, frame.line );
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user