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.

43 lines
870B

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