godot_voxel/util/profiling_clock.h
2019-05-05 01:09:12 +01:00

22 lines
399 B
C

#ifndef PROFILING_CLOCK_H
#define PROFILING_CLOCK_H
#include <core/os/os.h>
struct ProfilingClock {
uint64_t time_before = 0;
ProfilingClock() {
restart();
}
uint64_t restart() {
uint64_t now = OS::get_singleton()->get_ticks_usec();
uint64_t time_spent = now - time_before;
time_before = OS::get_singleton()->get_ticks_usec();
return time_spent;
}
};
#endif // PROFILING_CLOCK_H