diff --git a/include/cc_stats_log.h b/include/cc_stats_log.h new file mode 100644 index 000000000..265358be3 --- /dev/null +++ b/include/cc_stats_log.h @@ -0,0 +1,38 @@ +#pragma once + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include + + +#define STATS_LOG_FILE NULL /* default log file */ +#define STATS_LOG_NBUF 0 /* default log buf size */ + +/* name type default description */ +#define STATSLOG_OPTION(ACTION) \ + ACTION( stats_log_file, OPTION_TYPE_STR, NULL, "file storing stats" )\ + ACTION( stats_log_nbuf, OPTION_TYPE_UINT, STATS_LOG_NBUF, "stats log buf size" ) + +typedef struct { + STATSLOG_OPTION(OPTION_DECLARE) +} stats_log_options_st; + + +/* dump stats as CSV records into a log file, this allows metrics to be captured + * locally without setting up an observability infrastructure + */ +void stats_log_setup(stats_log_options_st *options); +void stats_log_teardown(void); + +void stats_log(struct metric metrics[], unsigned int nmetric); + +void stats_log_flush(void); + + +#ifdef __cplusplus +} +#endif + diff --git a/src/cc_debug.c b/src/cc_debug.c index 7c766260b..c0fd85a78 100644 --- a/src/cc_debug.c +++ b/src/cc_debug.c @@ -20,7 +20,6 @@ #include #include #include -#include