tildefriends/src/trace.h

35 lines
1.1 KiB
C
Raw Normal View History

#pragma once
/**
** \defgroup trace Performance Tracing
** Generates trace output that is compatible with speedscope.app,
** chrome://tracing or ui.perfetto.dev for scrutining what each thread is doing
** for optimization purposes.
** @{
*/
#include <inttypes.h>
#include <stddef.h>
typedef struct _tf_trace_t tf_trace_t;
typedef struct sqlite3 sqlite3;
tf_trace_t* tf_trace_create();
void tf_trace_destroy(tf_trace_t* trace);
void tf_trace_set_process_name(tf_trace_t* trace, const char* name);
void tf_trace_counter(tf_trace_t* trace, const char* name, int argc, const char** arg_names, const int64_t* arg_values);
void tf_trace_begin(tf_trace_t* trace, const char* name);
void tf_trace_end(tf_trace_t* trace);
char* tf_trace_export(tf_trace_t* trace);
typedef void(tf_trace_write_callback_t)(tf_trace_t* trace, const char* buffer, size_t size, void* user_data);
void tf_trace_set_write_callback(tf_trace_t* trace, tf_trace_write_callback_t* callback, void* user_data);
void tf_trace_raw(tf_trace_t* trace, const char* buffer, size_t size);
void tf_trace_sqlite(tf_trace_t* trace, sqlite3* sqlite);
/** @} */