"
42 | #define FORP_HIGHLIGHT_END "
%s [%.03f ms, %d b, level %d]
"
43 | #define FORP_STACK_REALLOC 1000
44 |
45 | typedef struct forp_function_t {
46 | char *filename;
47 | char *class;
48 | char *function;
49 | int type;
50 | char **groups;
51 | int groups_len;
52 | char *highlight;
53 | } forp_function_t;
54 |
55 | typedef struct forp_node_t {
56 | int key;
57 | int state;
58 |
59 | char *filename;
60 | int lineno;
61 | int level;
62 | struct forp_node_t *parent;
63 | char *caption;
64 | char *alias;
65 |
66 | forp_function_t function;
67 |
68 | // Memory
69 | signed long mem;
70 | signed long mem_begin;
71 | signed long mem_end;
72 |
73 | // Duration
74 | double time;
75 | double time_begin;
76 | long time_begin_timestamp_microseconds;
77 | double time_end;
78 |
79 | // Self cost
80 | double profiler_duration;
81 | } forp_node_t;
82 |
83 |
84 | /* Zend API proxies */
85 | #if PHP_VERSION_ID < 50500
86 | void (*old_execute)(zend_op_array *op_array TSRMLS_DC);
87 | void forp_execute(zend_op_array *op_array TSRMLS_DC);
88 | void (*old_execute_internal)(zend_execute_data *current_execute_data, int return_value_used TSRMLS_DC);
89 | void forp_execute_internal(zend_execute_data *current_execute_data, int return_value_used TSRMLS_DC);
90 | #else
91 | void (*old_execute_ex)(zend_execute_data *execute_data TSRMLS_DC);
92 | void forp_execute_ex(zend_execute_data *execute_data TSRMLS_DC);
93 | void (*old_execute_internal)(zend_execute_data *current_execute_data, struct _zend_fcall_info *fci, int return_value_used TSRMLS_DC);
94 | void forp_execute_internal(zend_execute_data *current_execute_data, struct _zend_fcall_info *fci, int return_value_used TSRMLS_DC);
95 | #endif
96 |
97 |
98 | static void forp_populate_function(forp_function_t *function, zend_execute_data *edata, zend_op_array *op_array TSRMLS_DC);
99 |
100 | void forp_info(TSRMLS_D);
101 |
102 | void forp_start(TSRMLS_D);
103 |
104 | void forp_end(TSRMLS_D);
105 |
106 | forp_node_t *forp_open_node(zend_execute_data *edata, zend_op_array *op_array TSRMLS_DC);
107 |
108 | void forp_close_node(forp_node_t *pn TSRMLS_DC);
109 |
110 | zval *forp_stack_dump_var(forp_var_t *var TSRMLS_DC);
111 |
112 | void forp_stack_dump(TSRMLS_D);
113 |
114 | void forp_stack_dump_cli_node(forp_node_t *node TSRMLS_DC);
115 |
116 | void forp_stack_dump_cli_var(forp_var_t *var, int depth TSRMLS_DC);
117 |
118 | void forp_stack_dump_cli(TSRMLS_D);
119 |
120 | int forp_is_profiling_function(forp_node_t *n TSRMLS_DC);
121 |
122 | #endif /* FORP_H */
123 |
124 | /*
125 | * Local variables:
126 | * tab-width: 4
127 | * c-basic-offset: 4
128 | * End:
129 | * vim600: noet sw=4 ts=4 fdm=marker
130 | * vim<600: noet sw=4 ts=4
131 | */
132 |
--------------------------------------------------------------------------------
/ext/forp/forp_annotation.c:
--------------------------------------------------------------------------------
1 | /*
2 | +----------------------------------------------------------------------+
3 | | PHP Version 5 |
4 | +----------------------------------------------------------------------+
5 | | Copyright (c) 1997-2011 The PHP Group |
6 | +----------------------------------------------------------------------+
7 | | This source file is subject to version 3.01 of the PHP license, |
8 | | that is bundled with this package in the file LICENSE, and is |
9 | | available through the world-wide-web at the following url: |
10 | | http://www.php.net/license/3_01.txt |
11 | | If you did not receive a copy of the PHP license and are unable to |
12 | | obtain it through the world-wide-web, please send a note to |
13 | | license@php.net so we can mail you a copy immediately. |
14 | +----------------------------------------------------------------------+
15 | | Author: Anthony Terrien