File: Timer.cpp

package info (click to toggle)
abyss 2.3.10-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 8,284 kB
  • sloc: cpp: 78,182; ansic: 6,512; makefile: 2,252; perl: 672; sh: 509; haskell: 412; python: 4
file content (18 lines) | stat: -rw-r--r-- 356 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include "Timer.h"
#include "Log.h"
#include <iomanip>

using namespace std;

// Constructor starts the timer
Timer::Timer(string funcString)
	: m_funcStr(funcString), m_start(clock())
{
}

// Destructor stops it and prints
Timer::~Timer()
{
	logger(2) << m_funcStr << ": " << setprecision(3)
		<< (double)(clock() - m_start) / CLOCKS_PER_SEC << " s\n";
}