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