Permalink
Browse files

renamed: Timer --> timer_t;

  • Loading branch information...
lvv committed Feb 25, 2012
1 parent 211de90 commit 5d824cd3addb8009ffefd520b732c4c5c32e92a0
Showing with 15 additions and 15 deletions.
  1. +1 −1 b-cmp.cc
  2. +2 −2 benchmark.h
  3. +5 −5 t-timer.cc
  4. +7 −7 timer.h
View
@@ -78,7 +78,7 @@ int main() {
///////////////////////////////////
Timer t(true);
timer_t t(true);
float sec, ticks;
cout << "\nValue\tSeconds\t\tTick/Cycle ... Min-Tick/Cycle \t Method\n" << setprecision(4);
View
@@ -17,14 +17,14 @@
using lvv::mk_array;
#include <lvv/timer.h>
using lvv::Timer;
using lvv::timer_t;
///////////////////////////////////////////////////////////////////////////////////////////// STATIC VARS
array<float,REPEAT> tick;
Timer t(true);
timer_t t(true);
float sec, ticks;
View
@@ -6,7 +6,7 @@ using namespace std;
#include <stdint.h>
#include <lvv/timer.h>
using lvv::Timer;
using lvv::timer_t;
int main() {
@@ -21,9 +21,9 @@ int main() {
cout << lvv::read_tick() << " -- 1 \n";
cout << lvv::read_tick() << " -- 1 \n";
cout << lvv::read_tick() << " -- 1 \n";
cout << "Timer CTOR\n";
Timer verboze_t(true);
Timer t;
cout << "timer_t CTOR\n";
timer_t verboze_t(true);
timer_t t;
t.print("timer.print() MSG test");
cout << "timer()=" << t() << endl;
@@ -40,6 +40,6 @@ int main() {
cout << "\n*** usleep 3000\n";
usleep(useconds_t(30000));
cout << "Last line will be from Timer destructor \n";
cout << "Last line will be from timer_t destructor \n";
return 0;
}
View
14 timer.h
@@ -69,10 +69,10 @@
}
#endif
class Timer;
static ostream& operator<< (ostream& os, Timer& t) __attribute__((unused)) ;
class timer_t;
static ostream& operator<< (ostream& os, timer_t& t) __attribute__((unused)) ;
class Timer { //=========================================== TIMER
class timer_t { //=========================================== TIMER
// TR http://www.viva64.com/en/b/0097/
// -------------
// article about hi-res timers: http://www.devx.com/cplus/Article/35375/0/page/2
@@ -125,7 +125,7 @@ class Timer { //=========================================== TIMER
Timer(bool verbose_dtor=false) : verbose_dtor(verbose_dtor) {
timer_t(bool verbose_dtor=false) : verbose_dtor(verbose_dtor) {
#if defined(__x86_64) || defined (__i386)
ctor_tick = interval_start_tick = read_tick();
overhead = interval_ticks();
@@ -134,7 +134,7 @@ Timer(bool verbose_dtor=false) : verbose_dtor(verbose_dtor) {
getrusage(RUSAGE_SELF, &now_ru); ctor_ru = interval_start_ru = now_ru;
};
~Timer() {
~timer_t() {
if (verbose_dtor)
cerr << "(*) on exit: cpu time: " << total_cpu() << "s " << "wall time: " << total_wall() << "s " << endl;
// memory report
@@ -207,12 +207,12 @@ print(std::string msg="") {
std::cerr << std::endl;
};
friend std::ostream& operator<< (std::ostream& os, Timer& t);
friend std::ostream& operator<< (std::ostream& os, timer_t& t);
};
static ostream&
operator<< (ostream& os, Timer& t) {
operator<< (ostream& os, timer_t& t) {
os << setprecision(5) << " " << t() << "s ";
return os;
}

0 comments on commit 5d824cd

Please sign in to comment.