diff options
author | Gael Guennebaud <g.gael@free.fr> | 2015-10-07 15:50:42 +0200 |
---|---|---|
committer | Gael Guennebaud <g.gael@free.fr> | 2015-10-07 15:50:42 +0200 |
commit | c6eb17cbe92d4ed29e918edb7b7a1decddcdd8b3 (patch) | |
tree | 7e45e568c796fca6724cc6541d26c646557e07bd /bench/BenchTimer.h | |
parent | f047ecc36a4e940417c1980d16e1b029539f8f10 (diff) |
Add helper routines to help bypassing some compiler otpimization when benchmarking
Diffstat (limited to 'bench/BenchTimer.h')
-rw-r--r-- | bench/BenchTimer.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/bench/BenchTimer.h b/bench/BenchTimer.h index 28e2bcaea..64666d75f 100644 --- a/bench/BenchTimer.h +++ b/bench/BenchTimer.h @@ -28,6 +28,14 @@ # include <unistd.h> #endif +static void escape(void *p) { + asm volatile("" : : "g"(p) : "memory"); +} + +static void clobber() { + asm volatile("" : : : "memory"); +} + #include <Eigen/Core> namespace Eigen @@ -168,6 +176,7 @@ public: CODE; \ } \ TIMER.stop(); \ + clobber(); \ } \ } |