summaryrefslogtreecommitdiffstats
path: root/BiomeVisualiser/Timer.h
blob: b18d37cb7538cb930f695184227a5e6e56b68147 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40

// Timer.h

// Declares the cTimer class representing a RAII class that measures time from its creation till its destruction





#pragma once

#include "time.h"





class cTimer
{
public:
	cTimer(const AString & a_Title) :
		m_Title(a_Title),
		m_StartTime(clock())
	{
	}
	
	~cTimer()
	{
		clock_t NumTicks = clock() - m_StartTime;
		LOG("%s took %d ticks (%.02f sec)", m_Title.c_str(), NumTicks, (double)NumTicks / CLOCKS_PER_SEC);
	}
	
protected:
	AString m_Title;
	clock_t m_StartTime;
} ;