mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-26 16:04:34 +00:00
Configurable callstack depth.
This commit is contained in:
parent
5368f386ce
commit
d2a98c3090
@ -10,6 +10,7 @@ extern "C" __declspec(dllimport) unsigned short __stdcall RtlCaptureStackBackTra
|
||||
|
||||
#ifdef TRACY_HAS_CALLSTACK
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
|
||||
@ -31,13 +32,12 @@ struct CallstackEntry
|
||||
void InitCallstack();
|
||||
CallstackEntry DecodeCallstackPtr( uint64_t ptr );
|
||||
|
||||
static tracy_force_inline void* Callstack()
|
||||
static tracy_force_inline void* Callstack( int depth )
|
||||
{
|
||||
enum { StackDepth = 24 };
|
||||
static_assert( StackDepth <= 63, "Stack depth can't be greater than 63." );
|
||||
assert( depth >= 1 && depth <= 63 );
|
||||
|
||||
auto trace = (uintptr_t*)tracy_malloc( ( 1 + StackDepth ) * sizeof( uintptr_t ) );
|
||||
const auto num = RtlCaptureStackBackTrace( 0, StackDepth, (void**)( trace+1 ), nullptr );
|
||||
auto trace = (uintptr_t*)tracy_malloc( ( 1 + depth ) * sizeof( uintptr_t ) );
|
||||
const auto num = RtlCaptureStackBackTrace( 0, depth, (void**)( trace+1 ), nullptr );
|
||||
*trace = num;
|
||||
|
||||
return trace;
|
||||
|
Loading…
Reference in New Issue
Block a user