1
1
#include < hxcpp.h>
2
+ #include < hx/TelemetryTracy.h>
2
3
#include < hx/Thread.h>
3
4
4
- #define TRACY_ENABLE
5
- #include " ../../project/thirdparty/tracy-0.11.1/tracy/TracyC.h"
6
- #include " ../../project/thirdparty/tracy-0.11.1/tracy/Tracy.hpp"
7
5
#include < vector>
8
6
9
- #ifdef HXCPP_TRACY_MEMORY
10
- #ifdef HXCPP_GC_MOVING
11
- #error "Error: HXCPP_TRACY_MEMORY is not supported when HXCPP_GC_MOVING is active."
12
- #endif
13
- #ifdef HXCPP_GC_GENERATIONAL
14
- #error "Error: HXCPP_TRACY_MEMORY is not supported when HXCPP_GC_GENERATIONAL is active."
15
- #endif
16
- #endif
17
-
18
7
namespace
19
8
{
20
9
TracyCZoneCtx gcZone;
@@ -239,25 +228,38 @@ void __hxcpp_tracy_framemark()
239
228
240
229
void __hxcpp_tracy_plot (String name, float val)
241
230
{
242
- ::tracy::Profiler::PlotData (name.c_str(), val);
231
+ hx::strbuf buffer;
232
+ ::tracy::Profiler::PlotData (name.utf8_str(&buffer), val);
243
233
}
244
234
245
235
void __hxcpp_tracy_plot_config (String name, uint8_t format, bool step, bool fill, int color)
246
236
{
247
- ::tracy::Profiler::ConfigurePlot (name.c_str(),::tracy::PlotFormatType(format), step, fill, color);
237
+ hx::strbuf buffer;
238
+ ::tracy::Profiler::ConfigurePlot (name.utf8_str(&buffer),::tracy::PlotFormatType(format), step, fill, color);
248
239
}
249
240
250
241
void __hxcpp_tracy_message (String msg, int color)
251
242
{
252
- ::tracy::Profiler::MessageColor (msg.c_str(), msg.length, color, 0);
243
+ hx::strbuf buffer;
244
+ ::tracy::Profiler::MessageColor (msg.utf8_str(&buffer), msg.length, color, 0);
253
245
}
254
246
255
247
void __hxcpp_tracy_message_app_info (String info)
256
248
{
257
- ::tracy::Profiler::MessageAppInfo (info.c_str(), info.length);
249
+ hx::strbuf buffer;
250
+ ::tracy::Profiler::MessageAppInfo (info.utf8_str(&buffer), info.length);
258
251
}
259
252
260
253
void __hxcpp_tracy_set_thread_name_and_group (String name, int groupHint)
261
254
{
262
- ::tracy::SetThreadNameWithHint (name.c_str(), groupHint);
255
+ hx::strbuf buffer;
256
+ ::tracy::SetThreadNameWithHint (name.utf8_str(&buffer), groupHint);
263
257
}
258
+
259
+ void __hxcpp_tracy_test_zone ()
260
+ {
261
+ ::hx::StackFrame _hx_stackframe (nullptr );
262
+ ::String name (" test" );
263
+
264
+ HXCPP_TRACY_ZONE (name);
265
+ }
0 commit comments