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