From 35a1d0d051546f0bbaae9338aa3fed4d04a9a92e Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Fri, 23 Oct 2009 18:14:55 +0000 Subject: New sandglass_bench_* macros, remove SANDGLASS_REALTICKS. sandglass_bench_fine() replaces SANDGLASS_REALTICKS; use SANDGLASS_CPUTIME instead. Also, sandglass_bench_noprecache() for when the expression to be timed has side-effects and should be executed only once. --- src/sandglass.c | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-) (limited to 'src/sandglass.c') diff --git a/src/sandglass.c b/src/sandglass.c index 6db28a3..f97b9c1 100644 --- a/src/sandglass.c +++ b/src/sandglass.c @@ -104,19 +104,10 @@ sandglass_real_create(sandglass_t *sandglass, switch (attr->incrementation) { case SANDGLASS_MONOTONIC: switch (attr->resolution) { - case SANDGLASS_REALTICKS: -#ifdef SANDGLASS_TSC - sandglass->resolution = sandglass_tsc_resolution(); - sandglass->loops = sandglass_tsc_loops(); - break; -#else - return -1; -#endif - case SANDGLASS_CPUTIME: #ifdef SANDGLASS_TSC sandglass->resolution = sandglass_tsc_resolution(); - sandglass->loops = 1; + sandglass->loops = sandglass_tsc_loops(); break; #else return -1; @@ -134,10 +125,6 @@ sandglass_real_create(sandglass_t *sandglass, case SANDGLASS_INTROSPECTIVE: switch (attr->resolution) { - case SANDGLASS_REALTICKS: - /* No such thing as an introspective raw TSC */ - return -1; - case SANDGLASS_CPUTIME: if (sysconf(_SC_THREAD_CPUTIME) > 0 || sysconf(_SC_CPUTIME) > 0) { sandglass->resolution = 1e9; @@ -202,7 +189,6 @@ sandglass_real_gettime(sandglass_t *sandglass) switch (sandglass->attributes.incrementation) { case SANDGLASS_MONOTONIC: switch (sandglass->attributes.resolution) { - case SANDGLASS_REALTICKS: case SANDGLASS_CPUTIME: #ifdef SANDGLASS_TSC sandglass->grains = sandglass_get_tsc(); @@ -230,10 +216,6 @@ sandglass_real_gettime(sandglass_t *sandglass) case SANDGLASS_INTROSPECTIVE: switch (sandglass->attributes.resolution) { - case SANDGLASS_REALTICKS: - /* No such thing as an introspective raw TSC */ - return -1; - case SANDGLASS_CPUTIME: if (sysconf(_SC_THREAD_CPUTIME) > 0) { if (clock_gettime(CLOCK_THREAD_CPUTIME_ID, &ts) != 0) -- cgit v1.2.3