mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-13 15:01:49 +00:00
add stopNs to timeutil::Timer
This commit is contained in:
parent
2475a7e8f5
commit
5d5a0e8932
2 changed files with 7 additions and 0 deletions
|
|
@ -5,6 +5,7 @@
|
||||||
using std::chrono::duration_cast;
|
using std::chrono::duration_cast;
|
||||||
using std::chrono::high_resolution_clock;
|
using std::chrono::high_resolution_clock;
|
||||||
using std::chrono::microseconds;
|
using std::chrono::microseconds;
|
||||||
|
using std::chrono::nanoseconds;
|
||||||
|
|
||||||
timeutil::Timer::Timer() {
|
timeutil::Timer::Timer() {
|
||||||
start = high_resolution_clock::now();
|
start = high_resolution_clock::now();
|
||||||
|
|
@ -14,6 +15,11 @@ int64_t timeutil::Timer::stop() {
|
||||||
.count();
|
.count();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int64_t timeutil::Timer::stopNs() {
|
||||||
|
return duration_cast<nanoseconds>(high_resolution_clock::now() - start)
|
||||||
|
.count();
|
||||||
|
}
|
||||||
|
|
||||||
timeutil::ScopeLogTimer::ScopeLogTimer(long long id) : scopeid_(id) {
|
timeutil::ScopeLogTimer::ScopeLogTimer(long long id) : scopeid_(id) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@ namespace timeutil {
|
||||||
public:
|
public:
|
||||||
Timer();
|
Timer();
|
||||||
int64_t stop();
|
int64_t stop();
|
||||||
|
int64_t stopNs();
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue