mirror of
https://github.com/wolfpld/tracy
synced 2025-05-04 22:23:52 +00:00
Add frame instrumentation achievement.
This commit is contained in:
parent
e4cda51bf6
commit
69c50cb6cb
@ -81,7 +81,31 @@ void SomeFunction()
|
|||||||
ImGui::PopFont();
|
ImGui::PopFont();
|
||||||
}, ac_instrumentationIntroItems };
|
}, ac_instrumentationIntroItems };
|
||||||
|
|
||||||
AchievementItem* ac_instrumentationItems[] = { &ai_instrumentationIntro, nullptr };
|
AchievementItem ai_instrumentFrames = { "instrumentFrames", "Instrumenting frames", [](const ctx& c){
|
||||||
|
constexpr const char* src = R"(#include "Tracy.hpp"
|
||||||
|
|
||||||
|
void Render()
|
||||||
|
{
|
||||||
|
// Render the frame
|
||||||
|
SwapBuffers();
|
||||||
|
FrameMark;
|
||||||
|
}
|
||||||
|
)";
|
||||||
|
|
||||||
|
static SourceContents sc;
|
||||||
|
sc.Parse( src );
|
||||||
|
|
||||||
|
ImGui::TextWrapped( "In addition to instrumenting functions, you can also instrument frames. This allows you to see how much time is spent in each frame of your application." );
|
||||||
|
ImGui::TextWrapped( "To instrument frames, you need to add the FrameMark macro at the beginning of each frame. This can be done in the main loop of your application, or in a separate function that is called at the beginning of each frame." );
|
||||||
|
ImGui::PushFont( c.fixed );
|
||||||
|
PrintSource( sc.get() );
|
||||||
|
ImGui::PopFont();
|
||||||
|
ImGui::TextWrapped( "When you profile your application, you will see a new frame appear on the timeline each time the FrameMark macro is called. This allows you to see how much time is spent in each frame and how many frames are rendered per second." );
|
||||||
|
ImGui::TextWrapped( "The FrameMark macro is a great way to see at a glance how your application is performing over time. Maybe there are some performance problems that only appear after a few minutes of running the application? A frame graph is drawn at the top of the profiler window where you can see the timing of all frames." );
|
||||||
|
ImGui::TextWrapped( "Note that some applications do not have a frame-based structure, and in such cases, frame instrumentation may not be useful. That's ok." );
|
||||||
|
} };
|
||||||
|
|
||||||
|
AchievementItem* ac_instrumentationItems[] = { &ai_instrumentationIntro, &ai_instrumentFrames, nullptr };
|
||||||
AchievementCategory ac_instrumentation = { "instrumentation", "Instrumentation", ac_instrumentationItems };
|
AchievementCategory ac_instrumentation = { "instrumentation", "Instrumentation", ac_instrumentationItems };
|
||||||
|
|
||||||
|
|
||||||
|
@ -685,6 +685,7 @@ bool View::DrawImpl()
|
|||||||
if( m_worker.GetZoneCount() > 0 ) Achieve( "instrumentationIntro" );
|
if( m_worker.GetZoneCount() > 0 ) Achieve( "instrumentationIntro" );
|
||||||
if( m_worker.GetZoneCount() > 100 * 1000 * 1000 ) Achieve( "100million" );
|
if( m_worker.GetZoneCount() > 100 * 1000 * 1000 ) Achieve( "100million" );
|
||||||
if( m_worker.GetCallstackSampleCount() > 0 ) Achieve( "samplingIntro" );
|
if( m_worker.GetCallstackSampleCount() > 0 ) Achieve( "samplingIntro" );
|
||||||
|
if( m_worker.AreFramesUsed() ) Achieve( "instrumentFrames" );
|
||||||
}
|
}
|
||||||
|
|
||||||
Attention( m_attnWorking );
|
Attention( m_attnWorking );
|
||||||
|
Loading…
x
Reference in New Issue
Block a user