From c6eb17cbe92d4ed29e918edb7b7a1decddcdd8b3 Mon Sep 17 00:00:00 2001 From: Gael Guennebaud Date: Wed, 7 Oct 2015 15:50:42 +0200 Subject: Add helper routines to help bypassing some compiler otpimization when benchmarking --- bench/BenchTimer.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'bench') 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 #endif +static void escape(void *p) { + asm volatile("" : : "g"(p) : "memory"); +} + +static void clobber() { + asm volatile("" : : : "memory"); +} + #include namespace Eigen @@ -168,6 +176,7 @@ public: CODE; \ } \ TIMER.stop(); \ + clobber(); \ } \ } -- cgit v1.2.3