summaryrefslogtreecommitdiffstats
path: root/src/sandglass.c
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@gmail.com>2009-10-23 18:14:55 +0000
committerTavian Barnes <tavianator@gmail.com>2009-10-23 18:14:55 +0000
commit35a1d0d051546f0bbaae9338aa3fed4d04a9a92e (patch)
tree3c7f63ca40df5f155b564e40cf13859bdefe5ad6 /src/sandglass.c
parent18068cf26d34d28db8c70e26930cd842c3aecfb4 (diff)
downloadlibsandglass-35a1d0d051546f0bbaae9338aa3fed4d04a9a92e.tar.xz
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.
Diffstat (limited to 'src/sandglass.c')
-rw-r--r--src/sandglass.c20
1 files changed, 1 insertions, 19 deletions
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)