add acces to statistics for runtime performance counters

This commit is contained in:
Daan 2025-03-21 19:12:08 -07:00
parent 385c8be259
commit 72b1b76e48
15 changed files with 544 additions and 333 deletions

View file

@ -79,6 +79,7 @@ static bool main_participates = false; // main thread participates as a
#define custom_free(p) free(p)
#else
#include <mimalloc.h>
#include <mimalloc-stats.h>
#define custom_calloc(n,s) mi_calloc(n,s)
#define custom_realloc(p,s) mi_realloc(p,s)
#define custom_free(p) mi_free(p)
@ -365,6 +366,11 @@ int main(int argc, char** argv) {
#ifndef NDEBUG
mi_debug_show_arenas();
mi_collect(true);
char* json = mi_stats_get_json(0, NULL);
if (json != NULL) {
fputs(json,stderr);
mi_free(json);
}
#endif
mi_stats_print(NULL);
#endif