Add a ghost zone achievement.

This commit is contained in:
Bartosz Taudul
2026-10-09 21:43:17 +02:00
parent 4a5bb61f60
commit d55cee0601
5 changed files with 22 additions and 1 deletions

View File

@@ -211,6 +211,7 @@ Embed(PROFILER_FILES TextAppInfo src/achievements/AppInfo.md TEXT)
Embed(PROFILER_FILES TextConnectToClient src/achievements/ConnectToClient.md TEXT)
Embed(PROFILER_FILES TextFindZone src/achievements/FindZone.md TEXT)
Embed(PROFILER_FILES TextFrameImages src/achievements/FrameImages.md TEXT)
Embed(PROFILER_FILES TextGhostZones src/achievements/GhostZones.md TEXT)
Embed(PROFILER_FILES TextGlobalSettings src/achievements/GlobalSettings.md TEXT)
Embed(PROFILER_FILES TextInstrumentationIntro src/achievements/InstrumentationIntro.md TEXT)
Embed(PROFILER_FILES TextInstrumentationStatistics src/achievements/InstrumentationStatistics.md TEXT)

View File

@@ -0,0 +1,9 @@
# Ghost zones
Automated sampling gives Tracy a rough picture of what your application was doing, even in places where you placed no zones. That data can be displayed as ghost zones, approximate spans of execution reconstructed from the samples, marked with the * ghost* icon so they are never mistaken for real instrumentation.
On any thread track that has both instrumented zones and sampling data, a * ghost* icon appears next to the thread label. Click it to switch that track between instrumented and ghost display, the same time range, viewed two ways. Threads that contain no instrumented zones display ghost zones automatically.
Ghost zone boundaries are only as accurate as the sampling period: sampling runs at 8 kHz on Windows and 10 kHz on Linux and Android, so times are quantized into steps of roughly 125 and 100 microseconds. Treat ghost zones as a guide, not a measurement. Switch a thread over and use the ghosts to pinpoint the functions that deserve real zones.
Now pick a thread and click its * ghost* icon. Try it out!

View File

@@ -7,6 +7,7 @@
#include "data/TextConnectToClient.hpp"
#include "data/TextFindZone.hpp"
#include "data/TextFrameImages.hpp"
#include "data/TextGhostZones.hpp"
#include "data/TextGlobalSettings.hpp"
#include "data/TextInstrumentFrames.hpp"
#include "data/TextInstrumentationIntro.hpp"
@@ -31,10 +32,19 @@ static std::string UnpackImpl( size_t size, size_t lz4Size, const uint8_t* data
#define Unpack( name ) UnpackImpl( Embed::name##Size, Embed::name##Lz4Size, Embed::name##Data )
AchievementItem ai_ghostZones = {
.id = "ghostZones",
.name = "Ghost zones",
.text = Unpack( TextGhostZones )
};
AchievementItem* ac_samplingIntroItems[] = { &ai_ghostZones, nullptr };
AchievementItem ai_samplingIntro = {
.id = "samplingIntro",
.name = "Sampling program execution",
.text = Unpack( TextSamplingIntro ),
.items = ac_samplingIntroItems,
};
AchievementItem* ac_samplingItems[] = { &ai_samplingIntro, nullptr };

View File

@@ -281,6 +281,7 @@ void TimelineItemThread::HeaderExtraContents( const TimelineContext& ctx, int of
{
if( IsMouseClicked( ImGuiMouseButton_Left ) )
{
if( s_config.achievements ) m_view.Achieve( "ghostZones" );
m_ghost = !m_ghost;
}
}

View File

@@ -213,6 +213,7 @@ public:
void DrawThread( const TimelineContext& ctx, const ThreadData& thread, const std::vector<TimelineDraw>& draw, const std::vector<ContextSwitchDraw>& ctxDraw, const std::vector<SamplesDraw>& samplesDraw, const std::vector<std::unique_ptr<LockDraw>>& lockDraw, int& offset, int depth, bool hasCtxSwitches, bool hasSamples );
void DrawThreadMessagesList( const TimelineContext& ctx, const std::vector<MessagesDraw>& drawList, int offset, uint64_t tid );
void DrawThreadOverlays( const ThreadData& thread, const ImVec2& ul, const ImVec2& dr );
void Achieve( const char* id );
static constexpr uint64_t AnyThread = ~0ull;
static constexpr uint32_t AnyLock = ~0u;
@@ -311,7 +312,6 @@ private:
void InitTextEditor();
void SetupConfig();
void SetupRanges();
void Achieve( const char* id );
void SaveUserData();
void SetZoomPreset( int idx );
void ZoomUserScale( int dir );