aboutsummaryrefslogtreecommitdiffhomepage
path: root/bench/btl/generic_bench
diff options
context:
space:
mode:
authorGravatar Gael Guennebaud <g.gael@free.fr>2008-07-10 18:28:50 +0000
committerGravatar Gael Guennebaud <g.gael@free.fr>2008-07-10 18:28:50 +0000
commit6f71ef8277405d268032f7c3bcaf316c7422c133 (patch)
tree419a7d46b9db1a64a6e94756ca70d1801196b061 /bench/btl/generic_bench
parent2b53fd4d53c87d41e26e4f178431f904ca2a42cd (diff)
resurrected tvmet, added mt4, intel's MKL and handcoded vectorized backends
in the benchmark suite
Diffstat (limited to 'bench/btl/generic_bench')
-rw-r--r--bench/btl/generic_bench/btl.hh2
-rwxr-xr-xbench/btl/generic_bench/timers/portable_timer.hh52
2 files changed, 30 insertions, 24 deletions
diff --git a/bench/btl/generic_bench/btl.hh b/bench/btl/generic_bench/btl.hh
index 97b0dec7c..5b561b676 100644
--- a/bench/btl/generic_bench/btl.hh
+++ b/bench/btl/generic_bench/btl.hh
@@ -18,8 +18,10 @@
//
#ifndef BTL_HH
#define BTL_HH
+
#include "bench_parameter.hh"
#include <iostream>
+#include <algorithm>
#include <vector>
#include <string>
#include "utilities.h"
diff --git a/bench/btl/generic_bench/timers/portable_timer.hh b/bench/btl/generic_bench/timers/portable_timer.hh
index 3b7c5266b..7d4059464 100755
--- a/bench/btl/generic_bench/timers/portable_timer.hh
+++ b/bench/btl/generic_bench/timers/portable_timer.hh
@@ -3,12 +3,12 @@
// Author : L. Plagne <laurent.plagne@edf.fr)> from boost lib
// Copyright (C) EDF R&D, lun sep 30 14:23:17 CEST 2002
//=====================================================
-//
+//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
-//
+//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@@ -16,18 +16,22 @@
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-//
+//
// simple_time extracted from the boost library
-//
+//
#ifndef _PORTABLE_TIMER_HH
#define _PORTABLE_TIMER_HH
+#include <ctime>
+#include <cstdlib>
+
#include <time.h>
#include <sys/time.h>
#include <sys/resource.h>
#include <unistd.h>
#include <sys/times.h>
+
#define USEC_IN_SEC 1000000
@@ -45,37 +49,37 @@ class Portable_Timer
_utime_usec_stop(-1)
{
}
-
- void start()
- {
-
+
+ void start()
+ {
+
int status=getrusage(RUSAGE_SELF, &resourcesUsage) ;
-
- _start_time = std::clock();
+
+ _start_time = std::clock();
_utime_sec_start = resourcesUsage.ru_utime.tv_sec ;
_utime_usec_start = resourcesUsage.ru_utime.tv_usec ;
}
-
- void stop()
- {
-
+
+ void stop()
+ {
+
int status=getrusage(RUSAGE_SELF, &resourcesUsage) ;
-
- _stop_time = std::clock();
-
+
+ _stop_time = std::clock();
+
_utime_sec_stop = resourcesUsage.ru_utime.tv_sec ;
_utime_usec_stop = resourcesUsage.ru_utime.tv_usec ;
-
+
}
double elapsed()
{
- return double(_stop_time - _start_time) / CLOCKS_PER_SEC;
+ return double(_stop_time - _start_time) / CLOCKS_PER_SEC;
}
-
+
double user_time()
{
long tot_utime_sec=_utime_sec_stop-_utime_sec_start;
@@ -83,17 +87,17 @@ class Portable_Timer
return double(tot_utime_sec)+ double(tot_utime_usec)/double(USEC_IN_SEC) ;
}
-
+
private:
struct rusage resourcesUsage ;
-
+
long _utime_sec_start ;
long _utime_usec_start ;
-
+
long _utime_sec_stop ;
long _utime_usec_stop ;
-
+
std::clock_t _start_time;
std::clock_t _stop_time;