From 189165d5c0a8092433c383424d6b8a0481546a7b Mon Sep 17 00:00:00 2001 From: boufaras Date: Thu, 29 Sep 2011 13:06:45 +0000 Subject: [PATCH] new class timer git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@2420 331e1502-861f-0410-8da2-ba01fb791d7f --- .../src/performance/moGPUTimer.h | 34 +++++++------------ 1 file changed, 13 insertions(+), 21 deletions(-) diff --git a/branches/ParadisEO-GPU/src/performance/moGPUTimer.h b/branches/ParadisEO-GPU/src/performance/moGPUTimer.h index d4d3fc2ee..44b3dd10c 100644 --- a/branches/ParadisEO-GPU/src/performance/moGPUTimer.h +++ b/branches/ParadisEO-GPU/src/performance/moGPUTimer.h @@ -35,8 +35,7 @@ #ifndef __moGPUTimer_H_ #define __moGPUTimer_H_ -// CUDA Utility Tools -#include +#include /** * To compute execution time @@ -46,7 +45,9 @@ class moGPUTimer { public: - unsigned int timer; + timeval tim; + double t1; + double t2; /** * Constructor @@ -54,9 +55,8 @@ public: moGPUTimer() { - timer = 0; - //Create timer - cutCreateTimer(&timer); + t1 = 0; + t2 = 0; } /** @@ -74,7 +74,8 @@ public: void start() { // Start timer - cutStartTimer(timer); + gettimeofday(&tim, NULL); + t1 = tim.tv_sec + (tim.tv_usec / 1000000.0); } /** @@ -84,30 +85,21 @@ public: void stop() { // Stop timer - cutStopTimer(timer); + gettimeofday(&tim, NULL); + t2 = tim.tv_sec + (tim.tv_usec / 1000000.0); } /** - * to get timer value in ms - * @return execution time in ms + * to get timer value in s + * @return execution time in s */ double getTime() { // get time - return cutGetTimerValue(timer); + return (t2 - t1); - } - - /** - * to delete timer - */ - - void deleteTimer() { - - //Delete timer - cutDeleteTimer(timer); }