aboutsummaryrefslogtreecommitdiff
blob: 55cc1008789e880e3badd7592b533a6525e792cc (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
#ifndef UTILITY_H
#define UTILITY_H

#include <iostream>
#include <chrono>

class TicToc
{
private:
	typedef std::chrono::high_resolution_clock clock;
	typedef std::chrono::microseconds res;
	clock::time_point t1, t2;

public:
	void tic()
	{
		t1 = clock::now();
	}

	void toc()
	{
		t2 = clock::now();
		std::cout << "Elapsed time: "
			<< std::chrono::duration_cast<res>(t2 - t1).count() / 1e6
			<< " seconds." << std::endl;
	}
};

#endif
Powered by cgit v1.2.3 (git 2.41.0)