2018-12-02 18:19:37 -08:00
|
|
|
//
|
|
|
|
// Created by aurailus on 02/12/18.
|
|
|
|
//
|
|
|
|
|
|
|
|
#ifndef GLPROJECT_TIMER_H
|
|
|
|
#define GLPROJECT_TIMER_H
|
|
|
|
|
|
|
|
#include <iostream>
|
|
|
|
#include <chrono>
|
|
|
|
|
|
|
|
class Timer {
|
|
|
|
public:
|
2019-07-11 23:50:24 -07:00
|
|
|
explicit Timer();
|
2018-12-02 18:19:37 -08:00
|
|
|
explicit Timer(const char* name);
|
|
|
|
|
2018-12-19 21:15:05 -08:00
|
|
|
long elapsedNs();
|
|
|
|
|
|
|
|
void printElapsedNs();
|
|
|
|
void printElapsedMs();
|
2019-07-11 23:50:24 -07:00
|
|
|
void printElapsedSeconds();
|
2018-12-02 18:19:37 -08:00
|
|
|
private:
|
2019-07-11 23:50:24 -07:00
|
|
|
bool hasName = false;
|
|
|
|
const char* name = nullptr;
|
2018-12-02 18:19:37 -08:00
|
|
|
std::chrono::high_resolution_clock::time_point start;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif //GLPROJECT_TIMER_H
|