From c1791fc96d8b3833e0caef9aa8a356a3b8ac0ab6 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sat, 27 Jul 2013 23:25:17 +0200 Subject: [PATCH] add support for a RESET operation --- src/timer.cpp | 6 ++++++ src/timer.h | 6 ++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/timer.cpp b/src/timer.cpp index d8880e20b6..78c5de0044 100644 --- a/src/timer.cpp +++ b/src/timer.cpp @@ -93,6 +93,12 @@ void Timer::_stamp(enum ttype which) previous_cpu = current_cpu; previous_wall = current_wall; + if (which == RESET) { + this->init(); + cpu_array[TOTAL] = current_cpu; + wall_array[TOTAL] = current_wall; + } + if (_sync) { MPI_Barrier(world); if (_level > NORMAL) current_cpu = CPU_Time(); diff --git a/src/timer.h b/src/timer.h index 4935aa7396..181e3521b8 100644 --- a/src/timer.h +++ b/src/timer.h @@ -30,7 +30,8 @@ class Timer : protected Pointers { ~Timer() {}; void init(); - // inline function to reduce overhead if we do not want detail timings + // inline function to reduce overhead if we want no detailed timings + void stamp(enum ttype which=START) { if (_level > LOOP) _stamp(which); } @@ -38,7 +39,8 @@ class Timer : protected Pointers { void barrier_start(); void barrier_stop(); - // getter methods about supported level of detail + // accessor methods for supported level of detail + bool has_loop() const { return (_level >= LOOP); } bool has_normal() const { return (_level >= NORMAL); } bool has_full() const { return (_level >= FULL); }