summaryrefslogtreecommitdiffstats
path: root/src/sandglass.c
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@gmail.com>2009-09-21 03:48:23 +0000
committerTavian Barnes <tavianator@gmail.com>2009-09-21 03:48:23 +0000
commit5f446ac4c9d98c7819ff836c0666c798f351ae2c (patch)
treebdd7fa89e4241c1a3ced8ff4a7074d779df2a053 /src/sandglass.c
parent0b12bb29adc33255b97d2fb995ef145f0127d950 (diff)
downloadlibsandglass-5f446ac4c9d98c7819ff836c0666c798f351ae2c.tar.xz
Make baseline calculations more accurate for SANDGLASS_REALTICKS.
Perform the baseline calculation directly in the sandglass_bench() macro, so that the baseline is calculated in the same place (and therefore optimization level, etc.) as the benchmarked code.
Diffstat (limited to 'src/sandglass.c')
-rw-r--r--src/sandglass.c17
1 files changed, 0 insertions, 17 deletions
diff --git a/src/sandglass.c b/src/sandglass.c
index b9316e5..6db28a3 100644
--- a/src/sandglass.c
+++ b/src/sandglass.c
@@ -189,16 +189,6 @@ sandglass_elapse(sandglass_t *sandglass)
/* Magical correction for timespec-based grains */
sandglass->grains += sandglass->adjustment;
- if (sandglass->attributes.resolution == SANDGLASS_REALTICKS) {
- baseline.attributes.incrementation = SANDGLASS_MONOTONIC;
- baseline.attributes.resolution = SANDGLASS_CPUTIME;
- baseline.loops = sandglass->loops;
-
- sandglass_bench(&baseline, { });
- sandglass->grains -= baseline.grains;
- sandglass->grains /= sandglass->loops;
- }
-
return 0;
}
@@ -213,13 +203,6 @@ sandglass_real_gettime(sandglass_t *sandglass)
case SANDGLASS_MONOTONIC:
switch (sandglass->attributes.resolution) {
case SANDGLASS_REALTICKS:
-#ifdef SANDGLASS_TSC
- sandglass->grains = sandglass_get_tsc();
- break;
-#else
- return -1;
-#endif
-
case SANDGLASS_CPUTIME:
#ifdef SANDGLASS_TSC
sandglass->grains = sandglass_get_tsc();