* src/vm/jit/show.c (show_global_lock): Renamed to mutex and changed
[cacao.git] / src / vm / statistics.h
1 /* src/vm/statistics.h - exports global varables for statistics
2
3    Copyright (C) 1996-2005, 2006, 2007, 2008
4    CACAOVM - Verein zur Foerderung der freien virtuellen Maschine CACAO
5
6    This file is part of CACAO.
7
8    This program is free software; you can redistribute it and/or
9    modify it under the terms of the GNU General Public License as
10    published by the Free Software Foundation; either version 2, or (at
11    your option) any later version.
12
13    This program is distributed in the hope that it will be useful, but
14    WITHOUT ANY WARRANTY; without even the implied warranty of
15    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16    General Public License for more details.
17
18    You should have received a copy of the GNU General Public License
19    along with this program; if not, write to the Free Software
20    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
21    02110-1301, USA.
22
23 */
24
25
26 #ifndef _STATISTICS_H
27 #define _STATISTICS_H
28
29 #include "config.h"
30
31 #include <stdint.h>
32
33 #include "vm/types.h"
34
35 #include "vm/global.h"
36
37
38 /* statistic macros ***********************************************************/
39
40 #if defined(ENABLE_STATISTICS)
41 #define STATISTICS(x) \
42     do { \
43         if (opt_stat) { \
44             x; \
45         } \
46     } while (0)
47 #else
48 #define STATISTICS(x)    /* nothing */
49 #endif
50
51 /* in_  inline statistics */
52
53 #define IN_MAX                  9
54 #define IN_UNIQUEVIRT           0x0000 
55 #define IN_UNIQUE_INTERFACE     0x0001
56 #define IN_OUTSIDERS            0x0004
57 #define IN_MAXDEPTH             0x0008
58 #define IN_MAXCODE              0x0010
59 #define IN_JCODELENGTH          0x0020
60 #define IN_EXCEPTION            0x0040
61 #define IN_NOT_UNIQUE_VIRT      0x0080
62 #define IN_NOT_UNIQUE_INTERFACE 0x0100
63
64 #define N_UNIQUEVIRT            0
65 #define N_UNIQUE_INTERFACE      1
66 #define N_OUTSIDERS             2
67 #define N_MAXDEPTH              3       
68 #define N_MAXCODE               4 
69 #define N_JCODELENGTH           5 
70 #define N_EXCEPTION            6 
71 #define N_NOT_UNIQUE_VIRT       7 
72 #define N_NOT_UNIQUE_INTERFACE  8 
73
74
75 /* global variables ***********************************************************/
76
77 extern s4 codememusage;
78 extern s4 maxcodememusage;
79
80 extern s4 memoryusage;
81 extern s4 maxmemusage;
82
83 extern s4 maxdumpsize;
84
85 extern s4 globalallocateddumpsize;
86 extern s4 globaluseddumpsize;
87
88
89 /* variables for measurements *************************************************/
90
91 extern s4 size_classinfo;
92 extern s4 size_fieldinfo;
93 extern s4 size_methodinfo;
94 extern s4 size_lineinfo;
95 extern s4 size_codeinfo;
96
97 extern s4 size_stub_native;
98
99 extern s4 size_stack_map;
100 extern s4 size_string;
101
102 extern s4 size_threadobject;
103 extern int32_t size_thread_index_t;
104 extern int32_t size_stacksize;
105
106 extern s4 size_lock_record;
107 extern s4 size_lock_hashtable;
108 extern s4 size_lock_waiter;
109
110 extern int32_t count_linenumbertable;
111 extern int32_t size_linenumbertable;
112
113 extern s4 size_patchref;
114
115 extern u8 count_calls_java_to_native;
116 extern u8 count_calls_native_to_java;
117
118 extern int count_const_pool_len;
119 extern int count_classref_len;
120 extern int count_parsed_desc_len;
121 extern int count_vftbl_len;
122 extern int count_all_methods;
123 extern int count_methods_marked_used;  /*RTA*/
124 extern int count_vmcode_len;
125 extern int count_extable_len;
126 extern int count_class_loads;
127 extern int count_class_inits;
128
129 extern int count_utf_len;               /* size of utf hash                   */
130 extern int count_utf_new;
131 extern int count_utf_new_found;
132
133 extern int count_locals_conflicts;
134 extern int count_locals_spilled;
135 extern int count_locals_register;
136 extern int count_ss_spilled;
137 extern int count_ss_register;
138 extern int count_methods_allocated_by_lsra;
139 extern int count_mem_move_bb;
140 extern int count_interface_size;
141 extern int count_argument_mem_ss;
142 extern int count_argument_reg_ss;
143 extern int count_method_in_register;
144 extern int count_mov_reg_reg;
145 extern int count_mov_mem_reg;
146 extern int count_mov_reg_mem;
147 extern int count_mov_mem_mem;
148
149 extern int count_jit_calls;
150 extern int count_methods;
151 extern int count_spills_read_ila;
152 extern int count_spills_read_flt;
153 extern int count_spills_read_dbl;
154 extern int count_spills_write_ila;
155 extern int count_spills_write_flt;
156 extern int count_spills_write_dbl;
157 extern int count_pcmd_activ;
158 extern int count_pcmd_drop;
159 extern int count_pcmd_zero;
160 extern int count_pcmd_const_store;
161 extern int count_pcmd_const_alu;
162 extern int count_pcmd_const_bra;
163 extern int count_pcmd_load;
164 extern int count_pcmd_move;
165 extern int count_load_instruction;
166 extern int count_pcmd_store;
167 extern int count_pcmd_store_comb;
168 extern int count_dup_instruction;
169 extern int count_pcmd_op;
170 extern int count_pcmd_mem;
171 extern int count_pcmd_met;
172 extern int count_pcmd_bra;
173 extern int count_pcmd_table;
174 extern int count_pcmd_return;
175 extern int count_pcmd_returnx;
176 extern int count_check_null;
177 extern int count_check_bound;
178 extern int count_max_basic_blocks;
179 extern int count_basic_blocks;
180 extern int count_max_javainstr;
181 extern int count_javainstr;
182 extern int count_javacodesize;
183 extern int count_javaexcsize;
184 extern int count_calls;
185 extern int count_tryblocks;
186 extern int count_code_len;
187 extern int count_data_len;
188 extern int count_cstub_len;
189 extern int count_max_new_stack;
190 extern int count_upper_bound_new_stack;
191
192 extern int count_emit_branch;
193 extern int count_emit_branch_8bit;
194 extern int count_emit_branch_16bit;
195 extern int count_emit_branch_32bit;
196 extern int count_emit_branch_64bit;
197
198 extern s4 count_branches_resolved;
199 extern s4 count_branches_unresolved;
200
201 extern int *count_block_stack;
202 extern int *count_analyse_iterations;
203 extern int *count_method_bb_distribution;
204 extern int *count_block_size_distribution;
205 extern int *count_store_length;
206 extern int *count_store_depth;
207                                 /* in_  inline statistics */
208 extern int count_in;
209 extern int count_in_uniqVirt;
210 extern int count_in_uniqIntf;
211 extern int count_in_rejected;
212 extern int count_in_rejected_mult;
213 extern int count_in_outsiders;
214 extern int count_in_uniqueVirt_not_inlined;
215 extern int count_in_uniqueInterface_not_inlined;
216 extern int count_in_maxDepth;
217 extern int count_in_maxMethods;
218
219 extern u2 count_in_not   [512];
220
221 /* instruction scheduler statistics *******************************************/
222
223 extern s4 count_schedule_basic_blocks;
224 extern s4 count_schedule_nodes;
225 extern s4 count_schedule_leaders;
226 extern s4 count_schedule_max_leaders;
227 extern s4 count_schedule_critical_path;
228
229
230 /* function prototypes ********************************************************/
231
232 s8 getcputime(void);
233
234 void loadingtime_start(void);
235 void loadingtime_stop(void);
236 void compilingtime_start(void);
237 void compilingtime_stop(void);
238
239 void print_times(void);
240 void print_stats(void);
241
242 void statistics_print_date(void);
243 void statistics_print_memory_usage(void);
244 void statistics_print_gc_memory_usage(void);
245
246 void mem_usagelog(bool givewarnings);
247
248 void compiledinvokation(void);
249 void jnicallXmethodnvokation(void);
250 void jniinvokation(void);
251
252 #endif /* _STATISTICS_H */
253
254
255 /*
256  * These are local overrides for various environment variables in Emacs.
257  * Please do not remove this and leave it at the end of the file, where
258  * Emacs will automagically detect them.
259  * ---------------------------------------------------------------------
260  * Local variables:
261  * mode: c
262  * indent-tabs-mode: t
263  * c-basic-offset: 4
264  * tab-width: 4
265  * End:
266  */