2023-05-31 15:03:53 +02:00
|
|
|
|
2023-10-23 14:41:55 +02:00
|
|
|
#include "pandemonium_profiling.h"
|
2023-05-31 15:03:53 +02:00
|
|
|
|
2023-10-23 15:35:24 +02:00
|
|
|
#include "os.h"
|
2023-05-31 15:03:53 +02:00
|
|
|
|
|
|
|
#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) {
|
2023-10-23 14:07:57 +02:00
|
|
|
Pandemonium::gdnative_profiling_add_data(signature, t);
|
2023-05-31 15:03:53 +02:00
|
|
|
}
|
|
|
|
}
|