* patcher_get_putstatic: Replaced c->initialized by
[cacao.git] / src / vm / statistics.c
1 /* src/vm/statistics.c - global varables for statistics
2
3    Copyright (C) 1996-2005 R. Grafl, A. Krall, C. Kruegel, C. Oates,
4    R. Obermaisser, M. Platter, M. Probst, S. Ring, E. Steiner,
5    C. Thalinger, D. Thuernbeck, P. Tomsich, C. Ullrich, J. Wenninger,
6    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., 59 Temple Place - Suite 330, Boston, MA
23    02111-1307, USA.
24
25    Contact: cacao@complang.tuwien.ac.at
26
27    Authors: Christian Thalinger
28
29    $Id: statistics.c 3514 2005-10-28 11:34:23Z twisti $
30
31 */
32
33
34 #include <string.h> 
35 #include <sys/time.h>
36 #include <sys/resource.h>
37
38 #include "toolbox/logging.h"
39 #include "vm/global.h"
40 #include "vm/options.h"
41 #include "vm/statistics.h"
42
43
44 /* global variables */
45
46 static s8 loadingtime = 0;              /* accumulated loading time           */
47 static s8 loadingstarttime = 0;
48 static s8 loadingstoptime = 0;
49 static s4 loadingtime_recursion = 0;
50
51 static s8 compilingtime = 0;            /* accumulated compile time           */
52 static s8 compilingstarttime = 0;
53 static s8 compilingstoptime = 0;
54 static s4 compilingtime_recursion = 0;
55
56 s4 codememusage = 0;
57 s4 maxcodememusage = 0;
58
59 s4 memoryusage = 0;
60 s4 maxmemusage = 0;
61
62 s4 maxdumpsize = 0;
63
64 s4 globalallocateddumpsize = 0;
65 s4 globaluseddumpsize = 0;
66
67 int count_class_infos = 0;              /* variables for measurements         */
68 int count_const_pool_len = 0;
69 int count_classref_len = 0;
70 int count_parsed_desc_len = 0;
71 int count_vftbl_len = 0;
72 int count_all_methods = 0;
73 int count_methods_marked_used = 0;  /* RTA */
74
75 int count_vmcode_len = 0;
76 int count_extable_len = 0;
77 int count_class_loads = 0;
78 int count_class_inits = 0;
79
80 int count_utf_len = 0;                  /* size of utf hash                   */
81 int count_utf_new = 0;                  /* calls of utf_new                   */
82 int count_utf_new_found  = 0;           /* calls of utf_new with fast return  */
83
84 int count_locals_conflicts = 0;         /* register allocator statistics */
85 int count_locals_spilled = 0;
86 int count_locals_register = 0;
87 int count_ss_spilled = 0;
88 int count_ss_register = 0;
89 int count_methods_allocated_by_lsra = 0;
90 int count_mem_move_bb = 0;
91 int count_interface_size = 0;
92 int count_argument_mem_ss = 0;
93 int count_argument_reg_ss = 0;
94 int count_method_in_register = 0;
95 int count_mov_reg_reg = 0;
96 int count_mov_mem_reg = 0;
97 int count_mov_reg_mem = 0;
98 int count_mov_mem_mem = 0;
99
100 int count_jit_calls = 0;
101 int count_methods = 0;
102 int count_spills = 0;
103 int count_spills_read = 0;
104 int count_pcmd_activ = 0;
105 int count_pcmd_drop = 0;
106 int count_pcmd_zero = 0;
107 int count_pcmd_const_store = 0;
108 int count_pcmd_const_alu = 0;
109 int count_pcmd_const_bra = 0;
110 int count_pcmd_load = 0;
111 int count_pcmd_move = 0;
112 int count_load_instruction = 0;
113 int count_pcmd_store = 0;
114 int count_pcmd_store_comb = 0;
115 int count_dup_instruction = 0;
116 int count_pcmd_op = 0;
117 int count_pcmd_mem = 0;
118 int count_pcmd_met = 0;
119 int count_pcmd_bra = 0;
120 int count_pcmd_table = 0;
121 int count_pcmd_return = 0;
122 int count_pcmd_returnx = 0;
123 int count_check_null = 0;
124 int count_check_bound = 0;
125 int count_max_basic_blocks = 0;
126 int count_basic_blocks = 0;
127 int count_javainstr = 0;
128 int count_max_javainstr = 0;
129 int count_javacodesize = 0;
130 int count_javaexcsize = 0;
131 int count_calls = 0;
132 int count_tryblocks = 0;
133 int count_code_len = 0;
134 int count_data_len = 0;
135 int count_cstub_len = 0;
136 int count_nstub_len = 0;
137 int count_max_new_stack = 0;
138 int count_upper_bound_new_stack = 0;
139                                 /* in_  inline statistics */
140 int count_in = 0;
141 int count_in_uniqVirt = 0;
142 int count_in_uniqIntf = 0;
143 int count_in_rejected = 0;
144 int count_in_rejected_mult = 0;
145 int count_in_outsiders = 0;
146 int count_in_uniqueVirt_not_inlined = 0;
147 int count_in_uniqueInterface_not_inlined = 0;
148 int count_in_maxDepth = 0;
149 int count_in_maxMethods = 0;
150
151 u8 count_native_function_calls=0;
152 u8 count_compiled_function_calls=0;
153 u8 count_jni_callXmethod_calls=0;
154 u8 count_jni_calls=0;
155
156 u2 count_in_not   [512];
157 /***
158 int count_no_in[12] = {0,0,0,0, 0,0,0,0, 0,0,0,0};
159 ***/
160
161
162
163 static int count_block_stack_init[11] = {
164         0, 0, 0, 0, 0, 
165         0, 0, 0, 0, 0, 
166         0
167 };
168 int *count_block_stack = count_block_stack_init;
169 static int count_analyse_iterations_init[5] = {
170         0, 0, 0, 0, 0
171 };
172 int *count_analyse_iterations = count_analyse_iterations_init;
173 static int count_method_bb_distribution_init[9] = {
174         0, 0, 0, 0, 0,
175         0, 0, 0, 0
176 };
177 int *count_method_bb_distribution = count_method_bb_distribution_init;
178 static int count_block_size_distribution_init[18] = {
179         0, 0, 0, 0, 0,
180         0, 0, 0, 0, 0,
181         0, 0, 0, 0, 0,
182         0, 0, 0
183 };
184 int *count_block_size_distribution = count_block_size_distribution_init;
185 static int count_store_length_init[21] = {
186         0, 0, 0, 0, 0,
187         0, 0, 0, 0, 0,
188         0, 0, 0, 0, 0,
189         0, 0, 0, 0, 0,
190         0
191 };
192 int *count_store_length = count_store_length_init;
193 static int count_store_depth_init[11] = {
194         0, 0, 0, 0, 0,
195         0, 0, 0, 0, 0,
196         0
197 };
198 int *count_store_depth = count_store_depth_init;
199
200
201 /* instruction scheduler statistics *******************************************/
202
203 s4 count_schedule_basic_blocks = 0;
204 s4 count_schedule_nodes = 0;
205 s4 count_schedule_leaders = 0;
206 s4 count_schedule_max_leaders = 0;
207 s4 count_schedule_critical_path = 0;
208
209
210
211 /* nativeinvokation ***********************************************************
212
213    increments the native invokation count by one
214         
215 *******************************************************************************/
216 void nativeinvokation() {
217         /*do locking here */
218         count_native_function_calls++;
219 }
220
221 /* compiledinvokation *********************************************************
222
223    increments the compiled invokation count by one
224         
225 *******************************************************************************/
226 void compiledinvokation() {
227         /* do locking here*/
228         count_compiled_function_calls++;
229 }
230
231
232 /* jnicallXmethodinvokation ***************************************************
233
234    increments the jni CallXMethod invokation count by one
235         
236 *******************************************************************************/
237 void jnicallXmethodnvokation() {
238         /*do locking here */
239         count_jni_callXmethod_calls++;
240 }
241
242 /* jniinvokation *************************************************************
243
244    increments the jni overall  invokation count by one
245         
246 *******************************************************************************/
247 void jniinvokation() {
248         /*do locking here */
249         count_jni_calls++;
250 }
251
252
253 /* getcputime *********************************** ******************************
254
255    Returns the used CPU time in microseconds
256         
257 *******************************************************************************/
258
259 s8 getcputime(void)
260 {
261         struct rusage ru;
262         int sec, usec;
263
264         getrusage(RUSAGE_SELF, &ru);
265         sec = ru.ru_utime.tv_sec + ru.ru_stime.tv_sec;
266         usec = ru.ru_utime.tv_usec + ru.ru_stime.tv_usec;
267
268         return sec * 1000000 + usec;
269 }
270
271
272 /* loadingtime_stop ************************************************************
273
274    XXX
275
276 *******************************************************************************/
277
278 void loadingtime_start(void)
279 {
280         loadingtime_recursion++;
281
282         if (loadingtime_recursion == 1)
283                 loadingstarttime = getcputime();
284 }
285
286
287 /* loadingtime_stop ************************************************************
288
289    XXX
290
291 *******************************************************************************/
292
293 void loadingtime_stop(void)
294 {
295         if (loadingtime_recursion == 1) {
296                 loadingstoptime = getcputime();
297                 loadingtime += (loadingstoptime - loadingstarttime);
298         }
299
300         loadingtime_recursion--;
301 }
302
303
304 /* compilingtime_stop **********************************************************
305
306    XXX
307
308 *******************************************************************************/
309
310 void compilingtime_start(void)
311 {
312         compilingtime_recursion++;
313
314         if (compilingtime_recursion == 1)
315                 compilingstarttime = getcputime();
316 }
317
318
319 /* compilingtime_stop **********************************************************
320
321    XXX
322
323 *******************************************************************************/
324
325 void compilingtime_stop(void)
326 {
327         if (compilingtime_recursion == 1) {
328                 compilingstoptime = getcputime();
329                 compilingtime += (compilingstoptime - compilingstarttime);
330         }
331
332         compilingtime_recursion--;
333 }
334
335
336 /* print_times *****************************************************************
337
338    Prints a summary of CPU time usage.
339
340 *******************************************************************************/
341
342 void print_times(void)
343 {
344         s8 totaltime;
345         s8 runtime;
346
347         totaltime = getcputime();
348         runtime = totaltime - loadingtime - compilingtime;
349
350 #if SIZEOF_VOID_P == 8
351         dolog("Time for loading classes: %6ld ms", loadingtime / 1000);
352         dolog("Time for compiling code:  %6ld ms", compilingtime / 1000);
353         dolog("Time for running program: %6ld ms", runtime / 1000);
354         dolog("Total time:               %6ld ms", totaltime / 1000);
355 #else
356         dolog("Time for loading classes: %6lld ms", loadingtime / 1000);
357         dolog("Time for compiling code:  %6lld ms", compilingtime / 1000);
358         dolog("Time for running program: %6lld ms", runtime / 1000);
359         dolog("Total time:               %6lld ms", totaltime / 1000);
360 #endif
361 }
362
363
364 /* print_stats *****************************************************************
365
366    outputs detailed compiler statistics
367
368 *******************************************************************************/
369
370 void print_stats(void)
371 {
372         dolog("Number of JIT compiler calls: %6d", count_jit_calls);
373         dolog("Number of compiled methods:   %6d", count_methods);
374
375         if (opt_rt)
376                 dolog("Number of Methods marked Used: %d", count_methods_marked_used);
377
378         dolog("Number of compiled basic blocks:               %6d",
379                   count_basic_blocks);
380         dolog("Number of max. basic blocks per method:        %6d",
381                   count_max_basic_blocks);
382
383         dolog("Number of compiled JavaVM instructions:        %6d",
384                   count_javainstr);
385         dolog("Number of max. JavaVM instructions per method: %6d",
386                   count_max_javainstr);
387         dolog("Size of compiled JavaVM instructions:          %6d(%d)",
388                   count_javacodesize, count_javacodesize - count_methods * 18);
389
390         dolog("Size of compiled Exception Tables:      %d", count_javaexcsize);
391         dolog("Number of Machine-Instructions: %d", count_code_len >> 2);
392         dolog("Number of Spills (write to memory): %d", count_spills);
393         dolog("Number of Spills (read from memory): %d", count_spills_read);
394         dolog("Number of Activ    Pseudocommands: %6d", count_pcmd_activ);
395         dolog("Number of Drop     Pseudocommands: %6d", count_pcmd_drop);
396         dolog("Number of Const    Pseudocommands: %6d (zero:%5d)",
397                   count_pcmd_load, count_pcmd_zero);
398         dolog("Number of ConstAlu Pseudocommands: %6d (cmp: %5d, store:%5d)",
399                   count_pcmd_const_alu, count_pcmd_const_bra, count_pcmd_const_store);
400         dolog("Number of Move     Pseudocommands: %6d", count_pcmd_move);
401         dolog("Number of Load     Pseudocommands: %6d", count_load_instruction);
402         dolog("Number of Store    Pseudocommands: %6d (combined: %5d)",
403                   count_pcmd_store, count_pcmd_store - count_pcmd_store_comb);
404         dolog("Number of OP       Pseudocommands: %6d", count_pcmd_op);
405         dolog("Number of DUP      Pseudocommands: %6d", count_dup_instruction);
406         dolog("Number of Mem      Pseudocommands: %6d", count_pcmd_mem);
407         dolog("Number of Method   Pseudocommands: %6d", count_pcmd_met);
408         dolog("Number of Branch   Pseudocommands: %6d (rets:%5d, Xrets: %5d)",
409                   count_pcmd_bra, count_pcmd_return, count_pcmd_returnx);
410         dolog("Number of Table    Pseudocommands: %6d", count_pcmd_table);
411         dolog("Number of Useful   Pseudocommands: %6d", count_pcmd_table +
412                   count_pcmd_bra + count_pcmd_load + count_pcmd_mem + count_pcmd_op);
413         dolog("Number of Null Pointer Checks:     %6d", count_check_null);
414         dolog("Number of Array Bound Checks:      %6d", count_check_bound);
415         dolog("Number of Try-Blocks: %d", count_tryblocks);
416         dolog("Maximal count of stack elements:   %d", count_max_new_stack);
417         dolog("Upper bound of max stack elements: %d", count_upper_bound_new_stack);
418         dolog("Distribution of stack sizes at block boundary");
419         dolog("     0     1     2     3     4     5     6     7     8     9  >=10");
420         dolog("%6d%6d%6d%6d%6d%6d%6d%6d%6d%6d%6d",
421                   count_block_stack[0], count_block_stack[1], count_block_stack[2],
422                   count_block_stack[3], count_block_stack[4], count_block_stack[5],
423                   count_block_stack[6], count_block_stack[7], count_block_stack[8],
424                   count_block_stack[9], count_block_stack[10]);
425         dolog("Distribution of store stack depth");
426         dolog("     0     1     2     3     4     5     6     7     8     9  >=10");
427         dolog("%6d%6d%6d%6d%6d%6d%6d%6d%6d%6d%6d",
428                   count_store_depth[0], count_store_depth[1], count_store_depth[2],
429                   count_store_depth[3], count_store_depth[4], count_store_depth[5],
430                   count_store_depth[6], count_store_depth[7], count_store_depth[8],
431                   count_store_depth[9], count_store_depth[10]);
432         dolog("Distribution of store creator chains first part");
433         dolog("     0     1     2     3     4     5     6     7     8     9");
434         dolog("%6d%6d%6d%6d%6d%6d%6d%6d%6d%6d",
435                   count_store_length[0], count_store_length[1], count_store_length[2],
436                   count_store_length[3], count_store_length[4], count_store_length[5],
437                   count_store_length[6], count_store_length[7], count_store_length[8],
438                   count_store_length[9]);
439         dolog("Distribution of store creator chains second part");
440         dolog("    10    11    12    13    14    15    16    17    18    19  >=20");
441         dolog("%6d%6d%6d%6d%6d%6d%6d%6d%6d%6d%6d",
442                   count_store_length[10], count_store_length[11],
443                   count_store_length[12], count_store_length[13],
444                   count_store_length[14], count_store_length[15],
445                   count_store_length[16], count_store_length[17],
446                   count_store_length[18], count_store_length[19],
447                   count_store_length[20]);
448         dolog("Distribution of analysis iterations");
449         dolog("     1     2     3     4   >=5");
450         dolog("%6d%6d%6d%6d%6d",
451                   count_analyse_iterations[0], count_analyse_iterations[1],
452                   count_analyse_iterations[2], count_analyse_iterations[3],
453                   count_analyse_iterations[4]);
454         dolog("Distribution of basic blocks per method");
455         dolog("   <=5  <=10  <=15  <=20  <=30  <=40  <=50  <=75   >75");
456         dolog("%6d%6d%6d%6d%6d%6d%6d%6d%6d",
457                   count_method_bb_distribution[0], count_method_bb_distribution[1],
458                   count_method_bb_distribution[2], count_method_bb_distribution[3],
459                   count_method_bb_distribution[4], count_method_bb_distribution[5],
460                   count_method_bb_distribution[6], count_method_bb_distribution[7],
461                   count_method_bb_distribution[8]);
462         dolog("Distribution of basic block sizes");
463         dolog("     0     1     2     3     4    5    6    7    8    9  <13  <15  <17  <19  <21  <26  <31  >30");
464         dolog("%6d%6d%6d%6d%6d%5d%5d%5d%5d%5d%5d%5d%5d%5d%5d%5d%5d%5d",
465                   count_block_size_distribution[0], count_block_size_distribution[1],
466                   count_block_size_distribution[2], count_block_size_distribution[3],
467                   count_block_size_distribution[4], count_block_size_distribution[5],
468                   count_block_size_distribution[6], count_block_size_distribution[7],
469                   count_block_size_distribution[8], count_block_size_distribution[9],
470                   count_block_size_distribution[10], count_block_size_distribution[11],
471                   count_block_size_distribution[12], count_block_size_distribution[13],
472                   count_block_size_distribution[14], count_block_size_distribution[15],
473                   count_block_size_distribution[16], count_block_size_distribution[17]);
474         dolog("Size of Code Area:        %10.3f kB", (float) count_code_len / 1024);
475         dolog("Size of Data Area:        %10.3f kB", (float) count_data_len / 1024);
476         dolog("Size of Class Infos:      %10.3f kB", (float) count_class_infos / 1024);
477         dolog("Size of Const Pool:       %10.3f kB", (float) (count_const_pool_len + count_utf_len) / 1024);
478         dolog("Size of Class refs:       %10.3f kB", (float) count_classref_len / 1024);
479         dolog("Size of descriptors:      %10.3f kB", (float) count_parsed_desc_len / 1024);
480         dolog("Size of vftbl:            %10.3f kB", (float) count_vftbl_len / 1024);
481         dolog("Size of compiler stubs:   %10.3f kB", (float) count_cstub_len / 1024);
482         dolog("Size of native stubs:     %10.3f kB", (float) count_nstub_len / 1024);
483         dolog("Size of utf:              %10.3f kB", (float) count_utf_len / 1024);
484         dolog("Size of VMCode:           %10.3f kB (%d)",
485                   (float) count_vmcode_len / 1024,
486                   count_vmcode_len - 18 * count_all_methods);
487         dolog("Size of exception tables: %10.3f kB\n", (float) count_extable_len / 1024);
488
489         dolog("Number of class loads:    %6d", count_class_loads);
490         dolog("Number of class inits:    %6d", count_class_inits);
491         dolog("Number of loaded Methods: %6d\n", count_all_methods);
492
493         dolog("Calls of utf_new:                 %6d", count_utf_new);
494         dolog("Calls of utf_new (element found): %6d\n", count_utf_new_found);
495
496
497         /* LSRA statistics ********************************************************/
498
499         dolog("Moves reg -> reg:     %6d", count_mov_reg_reg);
500         dolog("Moves mem -> reg:     %6d", count_mov_mem_reg);
501         dolog("Moves reg -> mem:     %6d", count_mov_reg_mem);
502         dolog("Moves mem -> mem:     %6d", count_mov_mem_mem);
503
504         dolog("Methods allocated by LSRA:         %6d",
505                   count_methods_allocated_by_lsra);
506         dolog("Conflicts between local Variables: %6d", count_locals_conflicts);
507         dolog("Local Variables held in Memory:    %6d", count_locals_spilled);
508         dolog("Local Variables held in Registers: %6d", count_locals_register);
509         dolog("Stackslots held in Memory:         %6d", count_ss_spilled);
510         dolog("Stackslots held in Registers:      %6d", count_ss_register);
511         dolog("Memory moves at BB Boundaries:     %6d", count_mem_move_bb);
512         dolog("Number of interface slots:         %6d\n", count_interface_size);
513         dolog("Number of Argument stack slots in register:  %6d",
514                   count_argument_reg_ss);
515         dolog("Number of Argument stack slots in memory:    %6d\n",
516                   count_argument_mem_ss);
517         dolog("Number of Methods kept in registers:         %6d\n",
518                   count_method_in_register);
519
520                 
521         /****if (useinlining)  ***/
522          {
523                 u2 i;
524                 char * in_not_reasons[IN_MAX] = {
525                                                 "unqVirt    | ",
526                                                 "unqIntf    | ",
527                                                 "outsider   | ",
528                                                 "maxDepth   | ",
529                                                 "maxcode    | ",
530                                                 "maxlen     | ",
531                                                 "exception  | ",
532                                                 "notUnqVirt | ",
533                                                 "notUnqIntf |"
534                                                 };
535
536                 dolog("Number of Methods Inlined :                              \t%6d",
537                           count_in);
538
539                 if (inlinevirtuals) {
540                         dolog("Number of Unique Virtual Methods inlined:                \t%6d",
541                                   count_in_uniqVirt);
542                         dolog("Number of Unique Implemented Interface Methods inlined:    %6d",
543                                   count_in_uniqIntf);
544                 }
545
546                 dolog("Number of Methods Inlines (total) rejected:              \t%6d",
547                           count_in_rejected);
548                 dolog("Number of Methods Inlined rejected for multiple reasons: \t%6d",
549                           count_in_rejected_mult);
550                 dolog("Number of Methods where Inline max depth hit:            \t%6d",
551                           count_in_maxDepth);
552                 dolog("Number of Methods Inlined rejected for max methods       \t%6d\n",
553                           count_in_maxMethods);
554                 dolog("Number of Methods calls fom Outsider Class not inlined:  \t%6d",
555                           count_in_outsiders);
556
557                 dolog("Number of Unique Virtual Methods not inlined:            \t%6d",
558                           count_in_uniqueVirt_not_inlined);
559                 dolog("Number of Unique Implemented Interface Methods not inlined:%6d\n",
560                           count_in_uniqueInterface_not_inlined);
561
562 #define INLINEDETAILS
563 #ifdef  INLINEDETAILS
564                 dolog("Details about Not Inlined Reasons:");
565
566                 for (i = 0; i < 512; i++) {
567                         if (count_in_not[i] > 0) {
568                                 /* XXX Please reimplement me! I'm ugly and insecure! */
569                                 char logtext2[1024]="\t";
570
571                                 if (inlinevirtuals) {
572                                         if (i & IN_UNIQUEVIRT)
573                                                 strcat(logtext2, in_not_reasons[N_UNIQUEVIRT]);
574
575                                         if (i & IN_UNIQUE_INTERFACE)
576                                                 strcat(logtext2, in_not_reasons[N_UNIQUE_INTERFACE]);
577
578                                         if (i & IN_NOT_UNIQUE_VIRT)
579                                                 strcat(logtext2, in_not_reasons[N_NOT_UNIQUE_VIRT]);
580
581                                         if (i & IN_NOT_UNIQUE_INTERFACE)
582                                                 strcat(logtext2, in_not_reasons[N_NOT_UNIQUE_INTERFACE]);
583                                 }
584
585                                 if (i & IN_OUTSIDERS)
586                                         strcat(logtext2, in_not_reasons[N_OUTSIDERS]);
587
588                                 if (i & IN_MAXDEPTH)
589                                         strcat(logtext2, in_not_reasons[N_MAXDEPTH]);
590
591                                 if (i & IN_MAXCODE)
592                                         strcat(logtext2, in_not_reasons[N_MAXCODE]);
593
594                                 if (i & IN_JCODELENGTH)
595                                         strcat(logtext2, in_not_reasons[N_JCODELENGTH]);
596
597                                 if (i & IN_EXCEPTION)
598                                         strcat(logtext2, in_not_reasons[N_EXCEPTION]);
599
600                                 dolog("  [%X]=%6d    %s", i, count_in_not[i], logtext2);
601                         }
602                 }
603 #endif
604          }
605
606
607          /* instruction scheduler statistics **************************************/
608
609 #if defined(USE_SCHEDULER)
610          dolog("Instruction scheduler statistics:");
611          dolog("Number of basic blocks:       %7d", count_schedule_basic_blocks);
612          dolog("Number of nodes:              %7d", count_schedule_nodes);
613          dolog("Number of leaders nodes:      %7d", count_schedule_leaders);
614          dolog("Number of max. leaders nodes: %7d", count_schedule_max_leaders);
615          dolog("Length of critical path:      %7d\n", count_schedule_critical_path);
616 #endif
617
618
619         /* call statistics ********************************************************/
620
621          dolog("Function call statistics:");
622          dolog("Number of native function invokations:           %ld",
623                    count_native_function_calls);
624          dolog("Number of compiled function invokations:         %ld",
625                    count_compiled_function_calls);
626          dolog("Number of jni->CallXMethod function invokations: %ld",
627                    count_jni_callXmethod_calls);
628          dolog("Overall number of jni invokations:               %ld",
629                    count_jni_calls);
630 }
631
632
633 /* mem_usagelog ****************************************************************
634
635    prints some memory related infos
636
637 *******************************************************************************/
638
639 void mem_usagelog(bool givewarnings)
640 {
641         if ((memoryusage != 0) && givewarnings) {
642                 dolog("Allocated memory not returned: %9d", (s4) memoryusage);
643         }
644
645         if ((globalallocateddumpsize != 0) && givewarnings) {
646                 dolog("Dump memory not returned:      %9d",
647                           (s4) globalallocateddumpsize);
648         }
649
650         dolog("Code - max. memory usage:      %9d kB",
651                   (s4) ((maxcodememusage + 1023) / 1024));
652         dolog("Random - max. memory usage:    %9d kB",
653                   (s4) ((maxmemusage + 1023) / 1024));
654         dolog("Dump - max. memory usage:      %9d kB",
655                   (s4) ((maxdumpsize + 1023) / 1024));
656 }
657
658
659 /*
660  * These are local overrides for various environment variables in Emacs.
661  * Please do not remove this and leave it at the end of the file, where
662  * Emacs will automagically detect them.
663  * ---------------------------------------------------------------------
664  * Local variables:
665  * mode: c
666  * indent-tabs-mode: t
667  * c-basic-offset: 4
668  * tab-width: 4
669  * End:
670  */