Integrated Chrome tracing

Added support for chrome tracing by integrating the
minitrace library (github.com/hrydgard/minitrace),
and modified it with a background flushing thread that allows
tracing to continue automatically after the predefined
1 million event limit.

Menu items and an accelerator (Ctr+T) have also been
added. Starting and stopping the trace simply replaces
trace.json with the new trace data.

The feature is disabled by default. Pass MINITRACE=y
to the build command to enable it. Some traces are
already added as an example, however they won't have
any effect if the feature is disabled.
This commit is contained in:
luisjoseromero
2021-02-10 20:22:51 +00:00
parent 16b321d12e
commit c0e7ac3762
12 changed files with 904 additions and 3 deletions

View File

@@ -49,7 +49,9 @@
#include <86box/win_sdl.h>
#include <86box/win.h>
#include <86box/version.h>
#ifdef MTR_ENABLED
#include <minitrace/minitrace.h>
#endif
typedef struct {
WCHAR str[512];
@@ -217,6 +219,21 @@ plat_get_string(int i)
return((wchar_t *)str);
}
#ifdef MTR_ENABLED
void
init_trace(void)
{
mtr_init("trace.json");
mtr_start();
}
void
shutdown_trace(void)
{
mtr_stop();
mtr_shutdown();
}
#endif
/* Create a console if we don't already have one. */
static void