2020-05-18 21:23:44 +02:00
|
|
|
#if defined (__cplusplus)
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
2020-05-18 20:39:33 +02:00
|
|
|
|
2020-05-19 00:22:56 +02:00
|
|
|
#define _POSIX_C_SOURCE 199309L
|
|
|
|
|
2020-05-18 20:39:33 +02:00
|
|
|
#include "map.h"
|
|
|
|
|
2020-05-19 00:22:56 +02:00
|
|
|
#include <time.h>
|
|
|
|
|
2020-05-18 20:39:33 +02:00
|
|
|
#define MILLION 1000000.0
|
|
|
|
|
|
|
|
#define MAX_FUNCTIONS 8192
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
map funcDatabase;
|
2020-05-19 00:22:56 +02:00
|
|
|
uint32_t frameCounter;
|
2020-05-18 20:39:33 +02:00
|
|
|
} profiler;
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
char* funcName; //stores function name
|
|
|
|
double timeSpent; //stores time spent in function in milliseconds
|
2020-05-19 00:22:56 +02:00
|
|
|
struct timespec start; //for timekeeping
|
2020-05-18 20:39:33 +02:00
|
|
|
uint32_t inProgress;
|
|
|
|
} funcData;
|
|
|
|
|
|
|
|
void initProfiler();
|
|
|
|
void startMeasure(void* func, const char* funcName);
|
2020-05-19 00:22:56 +02:00
|
|
|
void endMeasure(void* func);
|
|
|
|
void endFrame();
|
2020-05-18 20:39:33 +02:00
|
|
|
double getTimeSpent(void* func);
|
|
|
|
void profilePrintResults();
|
2020-05-19 00:22:56 +02:00
|
|
|
|
2020-05-18 21:23:44 +02:00
|
|
|
#if defined (__cplusplus)
|
|
|
|
}
|
|
|
|
#endif
|