diff --git a/alloc.c b/alloc.c index 6e8247b62..fc40f9f64 100644 --- a/alloc.c +++ b/alloc.c @@ -70,6 +70,14 @@ word GC_gc_no = 0; measure_performance = TRUE; } + GC_API void GC_CALL GC_enable_benchmark_stats(void) + { + const char *fname = TRUSTED_STRING(GETENV("GC_LOG_FILE")); + if (NULL == fname) + return; + GC_benchmark = 1; + } + GC_API unsigned long GC_CALL GC_get_full_gc_total_time(void) { return full_gc_total_time; diff --git a/include/gc/gc.h b/include/gc/gc.h index 471b8bd6f..52a862a1e 100644 --- a/include/gc/gc.h +++ b/include/gc/gc.h @@ -423,6 +423,10 @@ GC_API GC_word GC_CALL GC_get_allocd_bytes_per_finalizer(void); /* library has been compiled without NO_CLOCK. */ GC_API void GC_CALL GC_start_performance_measurement(void); +/* Tell the collector to log performance and memory measurements from */ +/* each collection to GC_LOG_FILE. */ +GC_API void GC_CALL GC_enable_benchmark_stats(void); + /* Get the total time of all full collections since the start of the */ /* performance measurements. Includes time spent in the supplementary */ /* actions like blacklists promotion, marks clearing, free lists */