1
0
mirror of https://github.com/Yours3lf/rpi-vk-driver.git synced 2024-11-29 11:24:14 +01:00
This commit is contained in:
yours3lf 2020-05-18 20:23:44 +01:00
parent b4b4e38354
commit a444f2e379
4 changed files with 32 additions and 11 deletions

View File

@ -37,8 +37,8 @@
#include "vkCaps.h" #include "vkCaps.h"
#define PROFILESTART(x) startMeasure((x), (#x)) #define PROFILESTART(x)// startMeasure((&x), (#x))
#define PROFILEEND(x) endMeasure((x)) #define PROFILEEND(x) endMeasure((&x))
/** /**
//scope //scope

View File

@ -288,8 +288,6 @@ void modeset_present(int fd, _image *buf, modeset_display_surface* surface)
void modeset_destroy_surface(int fd, modeset_display_surface *surface) void modeset_destroy_surface(int fd, modeset_display_surface *surface)
{ {
return;
//restore old state //restore old state
drmModeSetCrtc(fd, modeset_saved_states[surface->savedState].crtc->crtc_id, drmModeSetCrtc(fd, modeset_saved_states[surface->savedState].crtc->crtc_id,
modeset_saved_states[surface->savedState].crtc->buffer_id, modeset_saved_states[surface->savedState].crtc->buffer_id,

View File

@ -1,5 +1,16 @@
#if defined (__cplusplus)
extern "C" {
#endif
#include "profiler.h" #include "profiler.h"
/*
#define _POSIX_C_SOURCE 199309L
#include <time.h>
#include <unistd.h>
*/
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
@ -26,6 +37,7 @@ void initProfiler()
void startMeasure(void* func, const char* funcName) void startMeasure(void* func, const char* funcName)
{ {
/**
initProfiler(); initProfiler();
while(globalProfilerGuard); while(globalProfilerGuard);
@ -55,10 +67,12 @@ void startMeasure(void* func, const char* funcName)
globalProfilerGuard = 0; globalProfilerGuard = 0;
} }
/**/
} }
void endMeasure(void* func) void endMeasure(uint32_t func)
{ {
/**
struct timespec end; struct timespec end;
clock_gettime(CLOCK_REALTIME, &end); clock_gettime(CLOCK_REALTIME, &end);
@ -78,6 +92,7 @@ void endMeasure(void* func)
globalProfilerGuard = 0; globalProfilerGuard = 0;
} }
/**/
} }
@ -159,3 +174,8 @@ void profilePrintResults()
} }
} }
} }
#if defined (__cplusplus)
}
#endif

View File

@ -1,7 +1,6 @@
#define _POSIX_C_SOURCE 199309L #if defined (__cplusplus)
extern "C" {
#include <time.h> #endif
#include <unistd.h>
#include "map.h" #include "map.h"
@ -18,7 +17,7 @@ typedef struct
{ {
char* funcName; //stores function name char* funcName; //stores function name
double timeSpent; //stores time spent in function in milliseconds double timeSpent; //stores time spent in function in milliseconds
struct timespec start; //for timekeeping //struct timespec start; //for timekeeping
uint32_t inProgress; uint32_t inProgress;
} funcData; } funcData;
@ -26,8 +25,12 @@ void initProfiler();
void startMeasure(void* func, const char* funcName); void startMeasure(void* func, const char* funcName);
void endMeasure(void* func); void endMeasure(uint32_t func);
double getTimeSpent(void* func); double getTimeSpent(void* func);
void profilePrintResults(); void profilePrintResults();
#if defined (__cplusplus)
}
#endif