a19e78862dc4131a203d95dd04424f79817be695
[cacao.git] / src / vm / statistics.h
1 /* src/vm/statistics.h - exports global varables for statistics
2
3    Copyright (C) 1996-2005, 2006 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    Contact: cacao@cacaojvm.org
26
27    Authors: Christian Thalinger
28
29    $Id: statistics.h 6216 2006-12-18 18:21:37Z twisti $
30
31 */
32
33
34 #ifndef _STATISTICS_H
35 #define _STATISTICS_H
36
37 #include "config.h"
38 #include "vm/types.h"
39
40 #include "vm/global.h"
41
42
43 /* statistic macros ***********************************************************/
44
45 #if defined(ENABLE_STATISTICS)
46 #define STATISTICS(x) \
47     do { \
48         if (opt_stat) { \
49             x; \
50         } \
51     } while (0)
52 #else
53 #define STATISTICS(x)    /* nothing */
54 #endif
55
56 /* in_  inline statistics */
57
58 #define IN_MAX                  9
59 #define IN_UNIQUEVIRT           0x0000 
60 #define IN_UNIQUE_INTERFACE     0x0001
61 #define IN_OUTSIDERS            0x0004
62 #define IN_MAXDEPTH             0x0008
63 #define IN_MAXCODE              0x0010
64 #define IN_JCODELENGTH          0x0020
65 #define IN_EXCEPTION            0x0040
66 #define IN_NOT_UNIQUE_VIRT      0x0080
67 #define IN_NOT_UNIQUE_INTERFACE 0x0100
68
69 #define N_UNIQUEVIRT            0
70 #define N_UNIQUE_INTERFACE      1
71 #define N_OUTSIDERS             2
72 #define N_MAXDEPTH              3       
73 #define N_MAXCODE               4 
74 #define N_JCODELENGTH           5 
75 #define N_EXCEPTION            6 
76 #define N_NOT_UNIQUE_VIRT       7 
77 #define N_NOT_UNIQUE_INTERFACE  8 
78
79
80 /* global variables ***********************************************************/
81
82 extern s4 codememusage;
83 extern s4 maxcodememusage;
84
85 extern s4 memoryusage;
86 extern s4 maxmemusage;
87
88 extern s4 maxdumpsize;
89
90 extern s4 globalallocateddumpsize;
91 extern s4 globaluseddumpsize;
92
93
94 /* variables for measurements *************************************************/
95
96 extern s4 size_classinfo;
97 extern s4 size_fieldinfo;
98 extern s4 size_methodinfo;
99 extern s4 size_codeinfo;
100
101 extern s4 size_stack_map;
102
103 extern int count_const_pool_len;
104 extern int count_classref_len;
105 extern int count_parsed_desc_len;
106 extern int count_vftbl_len;
107 extern int count_all_methods;
108 extern int count_methods_marked_used;  /*RTA*/
109 extern int count_vmcode_len;
110 extern int count_extable_len;
111 extern int count_class_loads;
112 extern int count_class_inits;
113
114 extern int count_utf_len;               /* size of utf hash                   */
115 extern int count_utf_new;
116 extern int count_utf_new_found;
117
118 extern int count_locals_conflicts;
119 extern int count_locals_spilled;
120 extern int count_locals_register;
121 extern int count_ss_spilled;
122 extern int count_ss_register;
123 extern int count_methods_allocated_by_lsra;
124 extern int count_mem_move_bb;
125 extern int count_interface_size;
126 extern int count_argument_mem_ss;
127 extern int count_argument_reg_ss;
128 extern int count_method_in_register;
129 extern int count_mov_reg_reg;
130 extern int count_mov_mem_reg;
131 extern int count_mov_reg_mem;
132 extern int count_mov_mem_mem;
133
134 extern int count_jit_calls;
135 extern int count_methods;
136 extern int count_spills;
137 extern int count_spills_read;
138 extern int count_pcmd_activ;
139 extern int count_pcmd_drop;
140 extern int count_pcmd_zero;
141 extern int count_pcmd_const_store;
142 extern int count_pcmd_const_alu;
143 extern int count_pcmd_const_bra;
144 extern int count_pcmd_load;
145 extern int count_pcmd_move;
146 extern int count_load_instruction;
147 extern int count_pcmd_store;
148 extern int count_pcmd_store_comb;
149 extern int count_dup_instruction;
150 extern int count_pcmd_op;
151 extern int count_pcmd_mem;
152 extern int count_pcmd_met;
153 extern int count_pcmd_bra;
154 extern int count_pcmd_table;
155 extern int count_pcmd_return;
156 extern int count_pcmd_returnx;
157 extern int count_check_null;
158 extern int count_check_bound;
159 extern int count_max_basic_blocks;
160 extern int count_basic_blocks;
161 extern int count_max_javainstr;
162 extern int count_javainstr;
163 extern int count_javacodesize;
164 extern int count_javaexcsize;
165 extern int count_calls;
166 extern int count_tryblocks;
167 extern int count_code_len;
168 extern int count_data_len;
169 extern int count_cstub_len;
170 extern int count_nstub_len;
171 extern int count_max_new_stack;
172 extern int count_upper_bound_new_stack;
173
174 extern s4 count_branches_resolved;
175 extern s4 count_branches_unresolved;
176
177 extern int *count_block_stack;
178 extern int *count_analyse_iterations;
179 extern int *count_method_bb_distribution;
180 extern int *count_block_size_distribution;
181 extern int *count_store_length;
182 extern int *count_store_depth;
183                                 /* in_  inline statistics */
184 extern int count_in;
185 extern int count_in_uniqVirt;
186 extern int count_in_uniqIntf;
187 extern int count_in_rejected;
188 extern int count_in_rejected_mult;
189 extern int count_in_outsiders;
190 extern int count_in_uniqueVirt_not_inlined;
191 extern int count_in_uniqueInterface_not_inlined;
192 extern int count_in_maxDepth;
193 extern int count_in_maxMethods;
194
195 extern u2 count_in_not   [512];
196
197 /* instruction scheduler statistics *******************************************/
198
199 extern s4 count_schedule_basic_blocks;
200 extern s4 count_schedule_nodes;
201 extern s4 count_schedule_leaders;
202 extern s4 count_schedule_max_leaders;
203 extern s4 count_schedule_critical_path;
204
205
206 /* function prototypes ********************************************************/
207
208 s8 getcputime(void);
209
210 void loadingtime_start(void);
211 void loadingtime_stop(void);
212 void compilingtime_start(void);
213 void compilingtime_stop(void);
214
215 void print_times(void);
216 void print_stats(void);
217
218 void mem_usagelog(bool givewarnings);
219
220
221 void nativeinvokation(void);
222 void compiledinvokation(void);
223 void jnicallXmethodnvokation(void);
224 void jniinvokation(void);
225
226 #endif /* _STATISTICS_H */
227
228
229 /*
230  * These are local overrides for various environment variables in Emacs.
231  * Please do not remove this and leave it at the end of the file, where
232  * Emacs will automagically detect them.
233  * ---------------------------------------------------------------------
234  * Local variables:
235  * mode: c
236  * indent-tabs-mode: t
237  * c-basic-offset: 4
238  * tab-width: 4
239  * End:
240  */