commit
c1a0cde62d
2 changed files with 37 additions and 0 deletions
@ -0,0 +1,6 @@
@@ -0,0 +1,6 @@
|
||||
cmake_minimum_required(VERSION 3.25) |
||||
project(utils) |
||||
|
||||
set(CMAKE_CXX_STANDARD 17) |
||||
|
||||
add_library(utils INTERFACE utils.h) |
@ -0,0 +1,31 @@
@@ -0,0 +1,31 @@
|
||||
#ifndef __UTILS__ |
||||
#define __UTILS__ |
||||
#include <iostream> |
||||
#include <chrono> |
||||
namespace utils{ |
||||
|
||||
|
||||
class hdTimer{ |
||||
public: |
||||
hdTimer(){ |
||||
} |
||||
void tik(){ |
||||
start = std::chrono::high_resolution_clock::now(); |
||||
} |
||||
void tok(){ |
||||
end = std::chrono::high_resolution_clock::now(); |
||||
} |
||||
double cost(){ |
||||
return std::chrono::duration_cast<std::chrono::nanoseconds>(end-start).count(); |
||||
} |
||||
private: |
||||
|
||||
std::chrono::time_point<std::chrono::steady_clock> start,end; |
||||
|
||||
}; |
||||
|
||||
|
||||
} |
||||
|
||||
|
||||
#endif |
Loading…
Reference in new issue