github stephenberry/glaze v2.4.4
2.4.4

latest releases: v8.4.0, v8.3.0, v8.2.0...
2 years ago

See release v2.4.3 for the new time tracing/profiling support.

time tracing documentation

This update adds global tracing helpers for an alternative API:

It can be bothersome to pass around a glz::trace instance. A global instance is available with a separate API to avoid needing to pass a trace instance around.

glz::disable_trace() - Turns off the global tracing.
glz::enable_trace() - Turns on the global tracing if it had been disabled (enabled by default).
glz::trace_begin("my event") - Add a begin event for "my event"
glz::trace_end("my event") - Add an end event for "my event"
glz::trace_async_begin("my event") - Add an async_begin event for "my event"
glz::trace_async_end("my event") - Add an aysnc_end event for "my event"

Two structs are also provided that will automatically add the end events when they leave scope:
glz::duration_trace
glz::async_trace

Example:

void my_function_to_profile()
{
   glz::duration_trace trace{"my function to profile"};
   // do stuff here
   // glz::duration_trace will automatically add the end event when it goes out of scope.
}

Then, somewhere at the end of your program, write your global trace to file:

const auto ec = glz::write_file_trace("trace.json", std::string{});
if (ec) {
  std::cerr << "trace output failed\n";
}

by @stephenberry in #906

Full Changelog: v2.4.3...v2.4.4

Don't miss a new glaze release

NewReleases is sending notifications on new releases.