|
| 1 | +#ifndef HX_TELEMETRY_TRACY_H |
| 2 | +#define HX_TELEMETRY_TRACY_H |
| 3 | + |
| 4 | +#ifndef HXCPP_TRACY |
| 5 | + #error "Error: HXCPP_TRACY must be defined." |
| 6 | +#endif |
| 7 | + |
| 8 | +#define TRACY_ENABLE |
| 9 | +#include <hxcpp.h> |
| 10 | +#include "../../project/thirdparty/tracy-0.11.1/tracy/TracyC.h" |
| 11 | +#include "../../project/thirdparty/tracy-0.11.1/tracy/Tracy.hpp" |
| 12 | + |
| 13 | +#ifdef HXCPP_TRACY_MEMORY |
| 14 | + #ifdef HXCPP_GC_MOVING |
| 15 | + #error "Error: HXCPP_TRACY_MEMORY is not supported when HXCPP_GC_MOVING is active." |
| 16 | + #endif |
| 17 | + #ifdef HXCPP_GC_GENERATIONAL |
| 18 | + #error "Error: HXCPP_TRACY_MEMORY is not supported when HXCPP_GC_GENERATIONAL is active." |
| 19 | + #endif |
| 20 | +#endif |
| 21 | + |
| 22 | +#ifdef HXCPP_TRACY_INCLUDE_CALLSTACKS |
| 23 | +#define HXCPP_TRACY_ZONE(name) \ |
| 24 | + ::hx::strbuf TracyConcat(_hx_tracy_str_buffer, TracyLine); \ |
| 25 | + int TracyConcat(_hx_tracy_str_length, TracyLine); \ |
| 26 | + 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)); \ |
| 27 | + ::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()); |
| 28 | +#else |
| 29 | +#define HXCPP_TRACY_ZONE(name) \ |
| 30 | + ::hx::strbuf TracyConcat(_hx_tracy_str_buffer, TracyLine); \ |
| 31 | + int TracyConcat(_hx_tracy_str_length, TracyLine); \ |
| 32 | + 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)); \ |
| 33 | + ::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)); |
| 34 | +#endif |
| 35 | + |
| 36 | +void __hxcpp_tracy_framemark(); |
| 37 | +void __hxcpp_tracy_plot(::String name, ::Float val); |
| 38 | +void __hxcpp_tracy_plot_config(::String name, uint8_t format, bool step, bool fill, int color); |
| 39 | +void __hxcpp_tracy_message(::String msg, int color); |
| 40 | +void __hxcpp_tracy_message_app_info(::String info); |
| 41 | +void __hxcpp_tracy_set_thread_name_and_group(String name, int groupHint); |
| 42 | +int __hxcpp_tracy_get_zone_count(); |
| 43 | + |
| 44 | +#endif |
0 commit comments