mirror of
https://github.com/wolfpld/tracy.git
synced 2026-11-07 08:25:26 +00:00
Add an allocation call stacks achievement.
This commit is contained in:
@@ -206,6 +206,7 @@ add_custom_command(
|
||||
Embed(PROFILER_FILES Manual manual/tracy.md TEXT BUILD)
|
||||
|
||||
Embed(PROFILER_FILES Text100Million src/achievements/100Million.md TEXT)
|
||||
Embed(PROFILER_FILES TextAllocStacks src/achievements/AllocStacks.md TEXT)
|
||||
Embed(PROFILER_FILES TextAnnotateZones src/achievements/AnnotateZones.md TEXT)
|
||||
Embed(PROFILER_FILES TextAppInfo src/achievements/AppInfo.md TEXT)
|
||||
Embed(PROFILER_FILES TextConnectToClient src/achievements/ConnectToClient.md TEXT)
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
# Trace allocation call stacks
|
||||
|
||||
The allocation lists tell you what is in memory, but not who put it there. Swap the macros for their [S-postfix](#collectingcallstacks) variants, `TracyAllocS( ptr, size, depth )` and `TracyFreeS( ptr, depth )`, and every event carries a call stack. Capturing a stack costs time, and the cost grows with `depth`.
|
||||
|
||||
When the events carry stacks, the [Memory window](#memorywindow) can group them into trees. The * Top-down call stack tree* starts at the allocating functions and expands the call paths that led there, each level sorted by the bytes allocated in its branch, so the hottest allocators sit at the top. The bottom-up pane walks the same data the other way, from the call stack entry point down to the allocation site. Right-click a function name to list the [allocations](#alloclist) behind it.
|
||||
|
||||
Expand the top-down tree and follow the top branch. Try it out!
|
||||
@@ -2,6 +2,7 @@
|
||||
#include "TracyEmbed.hpp"
|
||||
|
||||
#include "data/Text100Million.hpp"
|
||||
#include "data/TextAllocStacks.hpp"
|
||||
#include "data/TextAnnotateZones.hpp"
|
||||
#include "data/TextAppInfo.hpp"
|
||||
#include "data/TextCompareTraces.hpp"
|
||||
@@ -70,7 +71,13 @@ AchievementItem ai_huntLeaks = {
|
||||
.text = Unpack( TextLeaks )
|
||||
};
|
||||
|
||||
AchievementItem* ac_trackMemoryItems[] = { &ai_huntLeaks, nullptr };
|
||||
AchievementItem ai_allocStacks = {
|
||||
.id = "allocStacks",
|
||||
.name = "Trace allocation call stacks",
|
||||
.text = Unpack( TextAllocStacks )
|
||||
};
|
||||
|
||||
AchievementItem* ac_trackMemoryItems[] = { &ai_huntLeaks, &ai_allocStacks, nullptr };
|
||||
|
||||
AchievementItem ai_trackMemory = {
|
||||
.id = "trackMemory",
|
||||
|
||||
@@ -466,6 +466,7 @@ void View::DrawMemory()
|
||||
auto tree = GetCallstackFrameTreeBottomUp( mem );
|
||||
if( !tree.empty() )
|
||||
{
|
||||
if( s_config.achievements ) Achieve( "allocStacks" );
|
||||
int idx = 0;
|
||||
DrawFrameTreeLevel( tree, idx );
|
||||
}
|
||||
@@ -504,6 +505,7 @@ void View::DrawMemory()
|
||||
auto tree = GetCallstackFrameTreeTopDown( mem );
|
||||
if( !tree.empty() )
|
||||
{
|
||||
if( s_config.achievements ) Achieve( "allocStacks" );
|
||||
int idx = 0;
|
||||
DrawFrameTreeLevel( tree, idx );
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user