summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@gmail.com>2010-03-05 11:00:47 -0500
committerTavian Barnes <tavianator@gmail.com>2010-03-05 11:00:47 -0500
commit0c717a13ccfdc8148337ccf5634720e1b77728e5 (patch)
treeda45ed52af4b71cb75fb482c84c92c0230d4995e
parent90e281d80fca2f15bc49e354a1e19f6baecffb15 (diff)
downloadlibsandglass-0c717a13ccfdc8148337ccf5634720e1b77728e5.tar.xz
Try harder to warm up the cache in sandglass_bench_*().
Populating branch-prediction tables etc. may take more than one go-round.
-rw-r--r--src/sandglass.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/sandglass.h b/src/sandglass.h
index 9e37578..b17d2a2 100644
--- a/src/sandglass.h
+++ b/src/sandglass.h
@@ -123,6 +123,8 @@ int sandglass_elapse(sandglass_t *sandglass);
/* Warm up the cache for these functions */ \
sandglass_begin(sandglass); \
sandglass_elapse(sandglass); \
+ sandglass_begin(sandglass); \
+ sandglass_elapse(sandglass); \
\
/* Time an empty loop for our baseline */ \
sandglass_begin(sandglass); \
@@ -136,6 +138,7 @@ int sandglass_elapse(sandglass_t *sandglass);
\
/* Warm up the cache for our routine */ \
routine; \
+ routine; \
\
/* Time our routine in a loop */ \
sandglass_begin(sandglass); \
@@ -159,6 +162,8 @@ int sandglass_elapse(sandglass_t *sandglass);
/* Warm up the cache for these functions */ \
sandglass_begin(sandglass); \
sandglass_elapse(sandglass); \
+ sandglass_begin(sandglass); \
+ sandglass_elapse(sandglass); \
\
/* Time an empty routine for our baseline */ \
sandglass_begin(sandglass); \
@@ -167,6 +172,7 @@ int sandglass_elapse(sandglass_t *sandglass);
\
/* Warm up the cache for our routine */ \
routine; \
+ routine; \
\
/* Time the routine */ \
sandglass_begin(sandglass); \
@@ -183,6 +189,8 @@ int sandglass_elapse(sandglass_t *sandglass);
/* Warm up the cache for these functions */ \
sandglass_begin(sandglass); \
sandglass_elapse(sandglass); \
+ sandglass_begin(sandglass); \
+ sandglass_elapse(sandglass); \
\
/* Time an empty loop for our baseline */ \
sandglass_begin(sandglass); \