You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

45 lines
884B

  1. #ifndef PERF_H
  2. #define PERF_H
  3. #include "nanovg.h"
  4. #ifdef __cplusplus
  5. extern "C" {
  6. #endif
  7. enum GraphrenderStyle {
  8. GRAPH_RENDER_FPS,
  9. GRAPH_RENDER_MS,
  10. };
  11. #define GRAPH_HISTORY_COUNT 100
  12. struct PerfGraph {
  13. int style;
  14. char name[32];
  15. float values[GRAPH_HISTORY_COUNT];
  16. int head;
  17. };
  18. typedef struct PerfGraph PerfGraph;
  19. void initGraph(PerfGraph* fps, int style, const char* name);
  20. void updateGraph(PerfGraph* fps, float frameTime);
  21. void renderGraph(NVGcontext* vg, float x, float y, PerfGraph* fps);
  22. float getGraphAverage(PerfGraph* fps);
  23. #define GPU_QUERY_COUNT 5
  24. struct GPUtimer {
  25. int supported;
  26. int cur, ret;
  27. unsigned int queries[GPU_QUERY_COUNT];
  28. };
  29. typedef struct GPUtimer GPUtimer;
  30. void initGPUTimer(GPUtimer* timer);
  31. void startGPUTimer(GPUtimer* timer);
  32. int stopGPUTimer(GPUtimer* timer, float* times, int maxTimes);
  33. #ifdef __cplusplus
  34. }
  35. #endif
  36. #endif // PERF_H