Skip to content

CMHAS/Timer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Introduction

A timer template class for timig and logging duration in C++ code.

Getting Started

Include Timer.h in a library or where you need it.
Example timer

Timer<double, std::micro> tm;
tm.start();
std::cout << "Hello World!\n";
tm.stop();
std::cout << tm.getDuration() << '\n';

Example log

tm.logValues();
std::this_thread::sleep_for(0.5s);
tm.logValues();
std::this_thread::sleep_for(0.75s);
tm.logValues();
for (const auto& i : tm.getDurationLog()) {
	std::cout << i << '\n';
}
tm.clearLog();

See main.cpp for complete example.

Build and Test

No need to build copy the file Timer.h. The unit test is in the TimerTest project.

Contribute

Feel free to contribute.

About

Class for timing code segments

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages