Add a chart values achievement.

This commit is contained in:
Bartosz Taudul
2026-10-12 21:11:28 +02:00
parent f5c0f348d7
commit 37a08e7b43
5 changed files with 22 additions and 0 deletions

View File

@@ -219,6 +219,7 @@ Embed(PROFILER_FILES TextInstrumentFrames src/achievements/InstrumentFrames.md T
Embed(PROFILER_FILES TextIntro src/achievements/Intro.md TEXT)
Embed(PROFILER_FILES TextLoadTrace src/achievements/LoadTrace.md TEXT)
Embed(PROFILER_FILES TextManual src/achievements/Manual.md TEXT)
Embed(PROFILER_FILES TextPlots src/achievements/Plots.md TEXT)
Embed(PROFILER_FILES TextSamplingIntro src/achievements/SamplingIntro.md TEXT)
Embed(PROFILER_FILES TextSaveTrace src/achievements/SaveTrace.md TEXT)
Embed(PROFILER_FILES TextSections src/achievements/Sections.md TEXT)

View File

@@ -0,0 +1,7 @@
# Chart values
Some questions are not about how long things take, but about how a number changes over time: draw calls per frame, queries in flight, queue depth. Use [plots](#plottingdata): `TracyPlot( "draw calls", count )` reports one point each time it is called, and the points become a plot lane below the threads in the timeline, where spikes and trends are easy to spot at a glance. Middle-click the plot header to zoom the view straight to the range the plot has recorded.
`TracyPlotConfig( name, type, step, fill, color )` is optional: pick a number format (`Number`, `Memory`, `Percentage`), hold values as a staircase instead of a smooth line, fill the area under the curve, or set the line color.
Pick a number that matters to your application, report it with `TracyPlot`, then middle-click the plot header to see its full span. Try it out!

View File

@@ -15,6 +15,7 @@
#include "data/TextIntro.hpp"
#include "data/TextLoadTrace.hpp"
#include "data/TextManual.hpp"
#include "data/TextPlots.hpp"
#include "data/TextSamplingIntro.hpp"
#include "data/TextSections.hpp"
#include "data/TextSaveTrace.hpp"
@@ -82,12 +83,19 @@ AchievementItem ai_markSections = {
.text = Unpack( TextSections )
};
AchievementItem ai_chartValues = {
.id = "chartValues",
.name = "Chart values",
.text = Unpack( TextPlots )
};
AchievementItem* ac_instrumentationIntroItems[] = {
&ai_100million,
&ai_instrumentationStatistics,
&ai_findZone,
&ai_annotateZones,
&ai_markSections,
&ai_chartValues,
nullptr
};

View File

@@ -25,6 +25,11 @@ bool TimelineItemPlot::IsEmpty() const
return m_plot->data.empty();
}
void TimelineItemPlot::HeaderZoomed()
{
if( s_config.achievements ) m_view.Achieve( "chartValues" );
}
const char* TimelineItemPlot::HeaderLabel() const
{
static char tmp[1024];

View File

@@ -26,6 +26,7 @@ protected:
void HeaderTooltip( const char* label ) const override;
void HeaderExtraContents( const TimelineContext& ctx, int offset, float labelWidth ) override;
void HeaderZoomed() override;
bool DrawContents( const TimelineContext& ctx, int& offset ) override;
void DrawFinished() override;