mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-10 02:31:48 +00:00
Implement memory allocation tracking for C API.
This commit is contained in:
parent
281477f7f9
commit
ee99ce833c
17
TracyC.h
17
TracyC.h
@ -22,6 +22,9 @@ typedef const void* TracyCZoneCtx;
|
||||
#define TracyCZoneText(c,x,y)
|
||||
#define TracyCZoneName(c,x,y)
|
||||
|
||||
#define TracyCAlloc(x,y)
|
||||
#define TracyCFree(x)
|
||||
|
||||
#else
|
||||
|
||||
#ifndef TracyConcat
|
||||
@ -71,6 +74,20 @@ void ___tracy_emit_zone_name( TracyCZoneCtx ctx, const char* txt, size_t size );
|
||||
#define TracyCZoneText( ctx, txt, size ) ___tracy_emit_zone_text( ctx, txt, size );
|
||||
#define TracyCZoneName( ctx, txt, size ) ___tracy_emit_zone_name( ctx, txt, size );
|
||||
|
||||
|
||||
void ___tracy_emit_memory_alloc( const void* ptr, size_t size );
|
||||
void ___tracy_emit_memory_alloc_callstack( const void* ptr, size_t size, int depth );
|
||||
void ___tracy_emit_memory_free( const void* ptr );
|
||||
void ___tracy_emit_memory_free_callstack( const void* ptr, int depth );
|
||||
|
||||
#if defined TRACY_HAS_CALLSTACK && defined TRACY_CALLSTACK
|
||||
# define TracyCAlloc( ptr, size ) ___tracy_emit_memory_alloc_callstack( ptr, size, TRACY_CALLSTACK )
|
||||
# define TracyCFree( ptr ) ___tracy_emit_memory_alloc_free_callstack( ptr, TRACY_CALLSTACK )
|
||||
#else
|
||||
# define TracyCAlloc( ptr, size ) ___tracy_emit_memory_alloc( ptr, size );
|
||||
# define TracyCFree( ptr ) ___tracy_emit_memory_free( ptr );
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@ -2244,6 +2244,26 @@ void ___tracy_emit_zone_name( TracyCZoneCtx ctx, const char* txt, size_t size )
|
||||
}
|
||||
}
|
||||
|
||||
void ___tracy_emit_memory_alloc( const void* ptr, size_t size )
|
||||
{
|
||||
tracy::Profiler::MemAlloc( ptr, size );
|
||||
}
|
||||
|
||||
void ___tracy_emit_memory_alloc_callstack( const void* ptr, size_t size, int depth )
|
||||
{
|
||||
tracy::Profiler::MemAllocCallstack( ptr, size, depth );
|
||||
}
|
||||
|
||||
void ___tracy_emit_memory_free( const void* ptr )
|
||||
{
|
||||
tracy::Profiler::MemFree( ptr );
|
||||
}
|
||||
|
||||
void ___tracy_emit_memory_free_callstack( const void* ptr, int depth )
|
||||
{
|
||||
tracy::Profiler::MemFreeCallstack( ptr, depth );
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user