Zepha/src/util/Timer.h

29 lines
484 B
C
Raw Normal View History

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:
explicit Timer();
2018-12-02 18:19:37 -08:00
explicit Timer(const char* name);
long elapsedNs();
void printElapsedNs();
void printElapsedMs();
void printElapsedSeconds();
2018-12-02 18:19:37 -08:00
private:
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