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.

46 lines
910B

  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. GRAPH_RENDER_PERCENT,
  11. };
  12. #define GRAPH_HISTORY_COUNT 100
  13. struct PerfGraph {
  14. int style;
  15. char name[32];
  16. float values[GRAPH_HISTORY_COUNT];
  17. int head;
  18. };
  19. typedef struct PerfGraph PerfGraph;
  20. void initGraph(PerfGraph* fps, int style, const char* name);
  21. void updateGraph(PerfGraph* fps, float frameTime);
  22. void renderGraph(NVGcontext* vg, float x, float y, PerfGraph* fps);
  23. float getGraphAverage(PerfGraph* fps);
  24. #define GPU_QUERY_COUNT 5
  25. struct GPUtimer {
  26. int supported;
  27. int cur, ret;
  28. unsigned int queries[GPU_QUERY_COUNT];
  29. };
  30. typedef struct GPUtimer GPUtimer;
  31. void initGPUTimer(GPUtimer* timer);
  32. void startGPUTimer(GPUtimer* timer);
  33. int stopGPUTimer(GPUtimer* timer, float* times, int maxTimes);
  34. #ifdef __cplusplus
  35. }
  36. #endif
  37. #endif // PERF_H