Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 29 additions & 5 deletions include/hx/TelemetryTracy.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,30 @@
#endif

#define TRACY_ENABLE
// NOTE: This has to match what TracyClient.cpp uses to build, or Tracy config will fail to link.
#ifdef HXCPP_TRACY_ON_DEMAND
#define TRACY_ON_DEMAND
#endif
#include <hxcpp.h>
#include "../../project/thirdparty/tracy-0.13.1/tracy/TracyC.h"
#include "../../project/thirdparty/tracy-0.13.1/tracy/Tracy.hpp"
#include "../../project/thirdparty/tracy-0.14.1/tracy/TracyC.h"
#include "../../project/thirdparty/tracy-0.14.1/tracy/Tracy.hpp"

#if TRACY_HAS_CALLSTACK == 1 || TRACY_HAS_CALLSTACK == 2 || TRACY_HAS_CALLSTACK == 5
// Clamp Haxe zone nesting callstack depth based on what Tracy accepts on this platform.
// Windows and Android throw an error at 63 or above, other platforms have no limit.
#define HXCPP_TRACY_MAX_CALLSTACK_DEPTH 62
#endif

inline int __hxcpp_tracy_callstack_depth(size_t zoneDepth)
{
#ifdef HXCPP_TRACY_MAX_CALLSTACK_DEPTH
if (zoneDepth > HXCPP_TRACY_MAX_CALLSTACK_DEPTH)
{
return HXCPP_TRACY_MAX_CALLSTACK_DEPTH;
}
#endif
return static_cast<int>(zoneDepth);
}

#ifdef HXCPP_TRACY_MEMORY
#ifdef HXCPP_GC_MOVING
Expand All @@ -22,18 +43,21 @@
#ifdef HXCPP_TRACY_INCLUDE_CALLSTACKS
#define HXCPP_TRACY_ZONE(name) \
::hx::strbuf TracyConcat(_hx_tracy_str_buffer, TracyLine); \
int TracyConcat(_hx_tracy_str_length, TracyLine); \
int TracyConcat(_hx_tracy_str_length, TracyLine) = 0; \
const char *TracyConcat(_hx_tracy_str_buffer_ptr, TracyLine) = name.utf8_str(&TracyConcat(_hx_tracy_str_buffer, TracyLine), false, &TracyConcat(_hx_tracy_str_length, TracyLine)); \
::tracy::ScopedZone TracyConcat(_hx_tracy_scoped_zone,TracyLine)(_hx_stackframe.lineNumber, _hx_stackframe.position->fileName, strlen(_hx_stackframe.position->fileName), _hx_stackframe.position->fullName, strlen(_hx_stackframe.position->fullName), TracyConcat(_hx_tracy_str_buffer_ptr, TracyLine), TracyConcat(_hx_tracy_str_length, TracyLine), __hxcpp_tracy_get_zone_count());
::tracy::ScopedZone TracyConcat(_hx_tracy_scoped_zone,TracyLine)(_hx_stackframe.lineNumber, _hx_stackframe.position->fileName, strlen(_hx_stackframe.position->fileName), _hx_stackframe.position->fullName, strlen(_hx_stackframe.position->fullName), TracyConcat(_hx_tracy_str_buffer_ptr, TracyLine), TracyConcat(_hx_tracy_str_length, TracyLine), __hxcpp_tracy_callstack_depth(__hxcpp_tracy_get_zone_count()));
#else
#define HXCPP_TRACY_ZONE(name) \
::hx::strbuf TracyConcat(_hx_tracy_str_buffer, TracyLine); \
int TracyConcat(_hx_tracy_str_length, TracyLine); \
int TracyConcat(_hx_tracy_str_length, TracyLine) = 0; \
const char *TracyConcat(_hx_tracy_str_buffer_ptr, TracyLine) = name.utf8_str(&TracyConcat(_hx_tracy_str_buffer, TracyLine), false, &TracyConcat(_hx_tracy_str_length, TracyLine)); \
::tracy::ScopedZone TracyConcat(_hx_tracy_scoped_zone,TracyLine)(_hx_stackframe.lineNumber, _hx_stackframe.position->fileName, strlen(_hx_stackframe.position->fileName), _hx_stackframe.position->fullName, strlen(_hx_stackframe.position->fullName), TracyConcat(_hx_tracy_str_buffer_ptr, TracyLine), TracyConcat(_hx_tracy_str_length, TracyLine), -1);
#endif

void __hxcpp_tracy_framemark();
void __hxcpp_tracy_framemark_named(::String name);
void __hxcpp_tracy_framemark_start(::String name);
void __hxcpp_tracy_framemark_end(::String name);
void __hxcpp_tracy_plot(::String name, ::Float val);
void __hxcpp_tracy_plot_config(::String name, uint8_t format, bool step, bool fill, int color);
void __hxcpp_tracy_message(::String msg, int color);
Expand Down
11 changes: 0 additions & 11 deletions project/thirdparty/tracy-0.13.1/client/TracyDebug.hpp

This file was deleted.

27 changes: 0 additions & 27 deletions project/thirdparty/tracy-0.13.1/common/TracyAlign.hpp

This file was deleted.

72 changes: 0 additions & 72 deletions project/thirdparty/tracy-0.13.1/common/TracyAlloc.hpp

This file was deleted.

16 changes: 0 additions & 16 deletions project/thirdparty/tracy-0.13.1/common/TracyApi.h

This file was deleted.

11 changes: 0 additions & 11 deletions project/thirdparty/tracy-0.13.1/common/TracyUwp.hpp

This file was deleted.

14 changes: 0 additions & 14 deletions project/thirdparty/tracy-0.13.1/common/TracyVersion.hpp

This file was deleted.

Loading