1 #ifndef Prof_INC_PROF_H 2 #define Prof_INC_PROF_H 3 4 5 //#define Prof_ENABLED 6 7 8 9 #include "prof_gather.h" 10 11 #ifdef __cplusplus 12 extern "C" { 13 #endif 14 15 /* 16 * Prof_update 17 * 18 * Pass in true (1) to accumulate history info; pass 19 * in false (0) to throw away the current frame's data 20 */ 21 extern void Prof_update(int record); 22 23 /* 24 * Prof_draw_gl -- display the current report via OpenGL 25 * 26 * You must provide a callable text-printing function. 27 * Put the opengl state into a 2d rendering mode. 28 * 29 * Parameters: 30 * <sx,sy> -- location where top line is drawn 31 * <width, height> -- total size of display (if too small, text will overprint) 32 * line_spacing -- how much to move sy by after each line; use a 33 * negative value if y decreases down the screen 34 * precision -- decimal places of precision for time data, 1..4 (try 2) 35 * print_text -- function to display a line of text starting at the 36 * given coordinate; best if 0,1..9 are fixed-width 37 * text_width -- a function that computes the pixel-width of 38 * a given string before printing. you can fake with a 39 * simple approximation of width('0')*strlen(str) 40 * 41 * to avoid overprinting, you can make print_text truncate long strings 42 */ 43 extern void Prof_draw_gl(float sx, float sy, 44 float width, float height, 45 float line_spacing, 46 int precision, 47 void (*print_text)(float x, float y, char *str), 48 float (*text_width)(char *str)); 49 50 /* 51 * Parameters 52 * <sx, sy> -- origin of the graph--location of (0,0) 53 * x_spacing -- screenspace size of each history sample; e.g. 54 * 2.0 pixels 55 * y_spacing -- screenspace size of one millisecond of time; 56 * for an app with max of 20ms in any one zone, 57 * 8.0 would produce a 160-pixel tall display, 58 * assuming screenspace is in pixels 59 */ 60 extern void Prof_draw_graph_gl(float sx, float sy, 61 float x_spacing, float y_spacing); 62 63 typedef enum 64 { 65 Prof_SELF_TIME, 66 Prof_HIERARCHICAL_TIME, 67 Prof_CALL_GRAPH, 68 } Prof_Report_Mode; 69 70 extern void Prof_set_report_mode(Prof_Report_Mode e); 71 extern void Prof_move_cursor(int delta); 72 extern void Prof_select(void); 73 extern void Prof_select_parent(void); 74 extern void Prof_move_frame(int delta); 75 76 extern void Prof_set_smoothing(int smoothing_mode); 77 extern void Prof_set_frame(int frame); 78 extern void Prof_set_cursor(int line); 79 80 typedef enum 81 { 82 Prof_FLATTEN_RECURSION, 83 Prof_SPREAD_RECURSION 84 } Prof_Recursion_Mode; 85 86 extern void Prof_set_recursion(Prof_Recursion_Mode e); 87 88 #ifdef __cplusplus 89 } 90 #endif 91 92 #endif // Prof_INC_PROF_H 93 94 95