From 8e360970a4d783a3e4865050b8556d4abe87a14c Mon Sep 17 00:00:00 2001 From: Petter Urkedal Date: Thu, 29 Sep 2011 20:05:45 +0200 Subject: [PATCH] Use gc_priv.h API for timing in tests/disclaim_bench.c. --- tests/disclaim_bench.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/tests/disclaim_bench.c b/tests/disclaim_bench.c index ba519836..cee0a3ec 100644 --- a/tests/disclaim_bench.c +++ b/tests/disclaim_bench.c @@ -21,6 +21,7 @@ // default (is it is not quite portable). #include "atomic_ops.h" +#include "private/gc_priv.h" #include "gc_disclaim.h" static int free_count = 0; @@ -79,7 +80,6 @@ int main(int argc, char **argv) int i; int model, model_min, model_max; testobj_t *keep_arr; - double t; GC_INIT(); GC_init_finalized_malloc(); @@ -106,17 +106,22 @@ int main(int argc, char **argv) printf("\t\t\tfin. ratio time/s time/fin.\n"); for (model = model_min; model <= model_max; ++model) { + double t = 0.0; free_count = 0; - t = -(double)clock(); + +# ifdef CLOCK_TYPE + CLOCK_TYPE tI, tF; + GET_TIME(tI); +# endif for (i = 0; i < ALLOC_CNT; ++i) { int k = rand() % KEEP_CNT; keep_arr[k] = testobj_new(model); } - GC_gcollect(); - - t += clock(); - t /= CLOCKS_PER_SEC; +# ifdef CLOCK_TYPE + GET_TIME(tF); + t = MS_TIME_DIFF(tF, tI)*1e-3; +# endif if (model < 2) printf("%20s: %12.4lf %12lg %12lg\n", model_str[model], -- 2.40.0