lnvis

nanovg lightning network visualizer
git clone git://jb55.com/lnvis
Log | Files | Refs | README | LICENSE

perf.h (934B)


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