1
0
mirror of https://github.com/Yours3lf/rpi-vk-driver.git synced 2024-12-12 00:08:54 +01:00
rpi-vk-driver/driver/profiler.h

39 lines
663 B
C
Raw Normal View History

2020-05-18 21:23:44 +02:00
#if defined (__cplusplus)
extern "C" {
#endif
2020-05-19 00:22:56 +02:00
#define _POSIX_C_SOURCE 199309L
#include "map.h"
2020-05-19 00:22:56 +02:00
#include <time.h>
#define MILLION 1000000.0
#define MAX_FUNCTIONS 8192
typedef struct
{
map funcDatabase;
2020-05-19 00:22:56 +02:00
uint32_t frameCounter;
} 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
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();
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