mirror of
https://github.com/Relintai/gdnative_cpp.git
synced 2024-11-20 10:57:23 +01:00
22 lines
448 B
C++
22 lines
448 B
C++
|
|
#include "pandemonium_profiling.h"
|
|
|
|
#include "os.h"
|
|
|
|
#include <cstdio>
|
|
|
|
|
|
|
|
FunctionProfiling::FunctionProfiling(const char *p_function, const int p_line) {
|
|
snprintf(signature, 1024, "::%d::%s", p_line, p_function);
|
|
ticks = OS::get_singleton()->get_ticks_usec();
|
|
}
|
|
|
|
FunctionProfiling::~FunctionProfiling() {
|
|
uint64_t t = OS::get_singleton()->get_ticks_usec() - ticks;
|
|
if (t > 0) {
|
|
Pandemonium::gdnative_profiling_add_data(signature, t);
|
|
}
|
|
}
|
|
|