* src/vm/jit/emit-common.c: Added emit_branch statistics.
[cacao.git] / src / vmcore / statistics.c
1 /* src/vmcore/statistics.c - 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    $Id: statistics.c 8082 2007-06-14 12:10:49Z tbfg $
26
27 */
28
29
30 #include "config.h"
31
32 #include <string.h> 
33
34 #if defined(HAVE_TIME_H)
35 # include <time.h>
36 #endif
37
38 #if defined(HAVE_SYS_TIME_H)
39 # include <sys/time.h>
40 #endif
41
42 #if defined(HAVE_SYS_RESOURCE_H)
43 # include <sys/resource.h>
44 #endif
45
46 #include "vm/types.h"
47
48 #include "mm/gc-common.h"
49
50 #include "toolbox/logging.h"
51
52 #include "vm/global.h"
53
54 #include "vm/jit/code.h"
55
56 #include "vmcore/class.h"
57 #include "vmcore/field.h"
58 #include "vmcore/method.h"
59 #include "vmcore/options.h"
60 #include "vmcore/statistics.h"
61
62
63 /* global variables ***********************************************************/
64
65 static s8 loadingtime = 0;              /* accumulated loading time           */
66 static s8 loadingstarttime = 0;
67 static s8 loadingstoptime = 0;
68 static s4 loadingtime_recursion = 0;
69
70 static s8 compilingtime = 0;            /* accumulated compile time           */
71 static s8 compilingstarttime = 0;
72 static s8 compilingstoptime = 0;
73 static s4 compilingtime_recursion = 0;
74
75 s4 codememusage = 0;
76 s4 maxcodememusage = 0;
77
78 s4 memoryusage = 0;
79 s4 maxmemusage = 0;
80
81 s4 maxdumpsize = 0;
82
83 s4 globalallocateddumpsize = 0;
84 s4 globaluseddumpsize = 0;
85
86
87 /* variables for measurements *************************************************/
88
89 s4 size_classinfo        = 0;
90 s4 size_fieldinfo        = 0;
91 s4 size_methodinfo       = 0;
92 s4 size_lineinfo         = 0;
93 s4 size_codeinfo         = 0;
94
95 s4 size_stub_native      = 0;
96
97 s4 size_stack_map        = 0;
98 s4 size_string           = 0;
99
100 s4 size_threadobject     = 0;
101
102 s4 size_lock_record      = 0;
103 s4 size_lock_hashtable   = 0;
104 s4 size_lock_waiter      = 0;
105
106 u8 count_calls_java_to_native = 0;
107 u8 count_calls_native_to_java = 0;
108
109 int count_const_pool_len = 0;
110 int count_classref_len = 0;
111 int count_parsed_desc_len = 0;
112 int count_vftbl_len = 0;
113 int count_all_methods = 0;
114 int count_methods_marked_used = 0;  /* RTA */
115
116 int count_vmcode_len = 0;
117 int count_extable_len = 0;
118 int count_class_loads = 0;
119 int count_class_inits = 0;
120
121 int count_utf_len = 0;                  /* size of utf hash                   */
122 int count_utf_new = 0;                  /* calls of utf_new                   */
123 int count_utf_new_found  = 0;           /* calls of utf_new with fast return  */
124
125 int count_locals_conflicts = 0;         /* register allocator statistics */
126 int count_locals_spilled = 0;
127 int count_locals_register = 0;
128 int count_ss_spilled = 0;
129 int count_ss_register = 0;
130 int count_methods_allocated_by_lsra = 0;
131 int count_mem_move_bb = 0;
132 int count_interface_size = 0;
133 int count_argument_mem_ss = 0;
134 int count_argument_reg_ss = 0;
135 int count_method_in_register = 0;
136 int count_mov_reg_reg = 0;
137 int count_mov_mem_reg = 0;
138 int count_mov_reg_mem = 0;
139 int count_mov_mem_mem = 0;
140
141 int count_jit_calls = 0;
142 int count_methods = 0;
143 int count_spills = 0;
144 int count_spills_read = 0;
145 int count_pcmd_activ = 0;
146 int count_pcmd_drop = 0;
147 int count_pcmd_zero = 0;
148 int count_pcmd_const_store = 0;
149 int count_pcmd_const_alu = 0;
150 int count_pcmd_const_bra = 0;
151 int count_pcmd_load = 0;
152 int count_pcmd_move = 0;
153 int count_load_instruction = 0;
154 int count_pcmd_store = 0;
155 int count_pcmd_store_comb = 0;
156 int count_dup_instruction = 0;
157 int count_pcmd_op = 0;
158 int count_pcmd_mem = 0;
159 int count_pcmd_met = 0;
160 int count_pcmd_bra = 0;
161 int count_pcmd_table = 0;
162 int count_pcmd_return = 0;
163 int count_pcmd_returnx = 0;
164 int count_check_null = 0;
165 int count_check_bound = 0;
166 int count_max_basic_blocks = 0;
167 int count_basic_blocks = 0;
168 int count_javainstr = 0;
169 int count_max_javainstr = 0;
170 int count_javacodesize = 0;
171 int count_javaexcsize = 0;
172 int count_calls = 0;
173 int count_tryblocks = 0;
174 int count_code_len = 0;
175 int count_data_len = 0;
176 int count_cstub_len = 0;
177 int count_max_new_stack = 0;
178 int count_upper_bound_new_stack = 0;
179
180 int count_emit_branch = 0;
181 int count_emit_branch_8bit = 0;
182 int count_emit_branch_16bit = 0;
183 int count_emit_branch_32bit = 0;
184 int count_emit_branch_64bit = 0;
185
186 s4 count_branches_resolved   = 0;
187 s4 count_branches_unresolved = 0;
188
189 u8 count_jni_callXmethod_calls=0;
190 u8 count_jni_calls=0;
191
192
193 static int count_block_stack_init[11] = {
194         0, 0, 0, 0, 0, 
195         0, 0, 0, 0, 0, 
196         0
197 };
198 int *count_block_stack = count_block_stack_init;
199 static int count_analyse_iterations_init[5] = {
200         0, 0, 0, 0, 0
201 };
202 int *count_analyse_iterations = count_analyse_iterations_init;
203 static int count_method_bb_distribution_init[9] = {
204         0, 0, 0, 0, 0,
205         0, 0, 0, 0
206 };
207 int *count_method_bb_distribution = count_method_bb_distribution_init;
208 static int count_block_size_distribution_init[18] = {
209         0, 0, 0, 0, 0,
210         0, 0, 0, 0, 0,
211         0, 0, 0, 0, 0,
212         0, 0, 0
213 };
214 int *count_block_size_distribution = count_block_size_distribution_init;
215 static int count_store_length_init[21] = {
216         0, 0, 0, 0, 0,
217         0, 0, 0, 0, 0,
218         0, 0, 0, 0, 0,
219         0, 0, 0, 0, 0,
220         0
221 };
222 int *count_store_length = count_store_length_init;
223 static int count_store_depth_init[11] = {
224         0, 0, 0, 0, 0,
225         0, 0, 0, 0, 0,
226         0
227 };
228 int *count_store_depth = count_store_depth_init;
229
230
231 /* instruction scheduler statistics *******************************************/
232
233 s4 count_schedule_basic_blocks = 0;
234 s4 count_schedule_nodes = 0;
235 s4 count_schedule_leaders = 0;
236 s4 count_schedule_max_leaders = 0;
237 s4 count_schedule_critical_path = 0;
238
239
240 /* jnicallXmethodinvokation ***************************************************
241
242    increments the jni CallXMethod invokation count by one
243         
244 *******************************************************************************/
245
246 void jnicallXmethodnvokation(void)
247 {
248         /* XXX do locking here */
249         count_jni_callXmethod_calls++;
250 }
251
252
253 /* jniinvokation *************************************************************
254
255    increments the jni overall  invokation count by one
256         
257 *******************************************************************************/
258
259 void jniinvokation(void)
260 {
261         /* XXX do locking here */
262         count_jni_calls++;
263 }
264
265
266 /* getcputime *********************************** ******************************
267
268    Returns the used CPU time in microseconds
269         
270 *******************************************************************************/
271
272 s8 getcputime(void)
273 {
274 #if defined(HAVE_GETRUSAGE)
275         struct rusage ru;
276         int sec, usec;
277
278         getrusage(RUSAGE_SELF, &ru);
279
280         sec  = ru.ru_utime.tv_sec + ru.ru_stime.tv_sec;
281         usec = ru.ru_utime.tv_usec + ru.ru_stime.tv_usec;
282
283         return sec * 1000000 + usec;
284 #else
285         /* If we don't have getrusage, simply return 0. */
286
287         return 0;
288 #endif
289 }
290
291
292 /* loadingtime_stop ************************************************************
293
294    XXX
295
296 *******************************************************************************/
297
298 void loadingtime_start(void)
299 {
300         loadingtime_recursion++;
301
302         if (loadingtime_recursion == 1)
303                 loadingstarttime = getcputime();
304 }
305
306
307 /* loadingtime_stop ************************************************************
308
309    XXX
310
311 *******************************************************************************/
312
313 void loadingtime_stop(void)
314 {
315         if (loadingtime_recursion == 1) {
316                 loadingstoptime = getcputime();
317                 loadingtime += (loadingstoptime - loadingstarttime);
318         }
319
320         loadingtime_recursion--;
321 }
322
323
324 /* compilingtime_stop **********************************************************
325
326    XXX
327
328 *******************************************************************************/
329
330 void compilingtime_start(void)
331 {
332         compilingtime_recursion++;
333
334         if (compilingtime_recursion == 1)
335                 compilingstarttime = getcputime();
336 }
337
338
339 /* compilingtime_stop **********************************************************
340
341    XXX
342
343 *******************************************************************************/
344
345 void compilingtime_stop(void)
346 {
347         if (compilingtime_recursion == 1) {
348                 compilingstoptime = getcputime();
349                 compilingtime += (compilingstoptime - compilingstarttime);
350         }
351
352         compilingtime_recursion--;
353 }
354
355
356 /* print_times *****************************************************************
357
358    Prints a summary of CPU time usage.
359
360 *******************************************************************************/
361
362 void print_times(void)
363 {
364         s8 totaltime;
365         s8 runtime;
366
367         totaltime = getcputime();
368         runtime = totaltime - loadingtime - compilingtime;
369
370 #if SIZEOF_VOID_P == 8
371         dolog("Time for loading classes: %6ld ms", loadingtime / 1000);
372         dolog("Time for compiling code:  %6ld ms", compilingtime / 1000);
373         dolog("Time for running program: %6ld ms", runtime / 1000);
374         dolog("Total time:               %6ld ms", totaltime / 1000);
375 #else
376         dolog("Time for loading classes: %6lld ms", loadingtime / 1000);
377         dolog("Time for compiling code:  %6lld ms", compilingtime / 1000);
378         dolog("Time for running program: %6lld ms", runtime / 1000);
379         dolog("Total time:               %6lld ms", totaltime / 1000);
380 #endif
381 }
382
383
384 /* print_stats *****************************************************************
385
386    outputs detailed compiler statistics
387
388 *******************************************************************************/
389
390 void print_stats(void)
391 {
392         s4    i;
393         float f;
394         s4    sum;
395
396
397         dolog("Number of JIT compiler calls: %6d", count_jit_calls);
398         dolog("Number of compiled methods:   %6d", count_methods);
399
400         dolog("Number of compiled basic blocks:               %6d",
401                   count_basic_blocks);
402         dolog("Number of max. basic blocks per method:        %6d",
403                   count_max_basic_blocks);
404
405         dolog("Number of compiled JavaVM instructions:        %6d",
406                   count_javainstr);
407         dolog("Number of max. JavaVM instructions per method: %6d",
408                   count_max_javainstr);
409         dolog("Size of compiled JavaVM instructions:          %6d(%d)",
410                   count_javacodesize, count_javacodesize - count_methods * 18);
411
412         dolog("Size of compiled Exception Tables:      %d", count_javaexcsize);
413         dolog("Number of Machine-Instructions: %d", count_code_len >> 2);
414         dolog("Number of Spills (write to memory): %d", count_spills);
415         dolog("Number of Spills (read from memory): %d", count_spills_read);
416         dolog("Number of Activ    Pseudocommands: %6d", count_pcmd_activ);
417         dolog("Number of Drop     Pseudocommands: %6d", count_pcmd_drop);
418         dolog("Number of Const    Pseudocommands: %6d (zero:%5d)",
419                   count_pcmd_load, count_pcmd_zero);
420         dolog("Number of ConstAlu Pseudocommands: %6d (cmp: %5d, store:%5d)",
421                   count_pcmd_const_alu, count_pcmd_const_bra, count_pcmd_const_store);
422         dolog("Number of Move     Pseudocommands: %6d", count_pcmd_move);
423         dolog("Number of Load     Pseudocommands: %6d", count_load_instruction);
424         dolog("Number of Store    Pseudocommands: %6d (combined: %5d)",
425                   count_pcmd_store, count_pcmd_store - count_pcmd_store_comb);
426         dolog("Number of OP       Pseudocommands: %6d", count_pcmd_op);
427         dolog("Number of DUP      Pseudocommands: %6d", count_dup_instruction);
428         dolog("Number of Mem      Pseudocommands: %6d", count_pcmd_mem);
429         dolog("Number of Method   Pseudocommands: %6d", count_pcmd_met);
430         dolog("Number of Branch   Pseudocommands: %6d (rets:%5d, Xrets: %5d)",
431                   count_pcmd_bra, count_pcmd_return, count_pcmd_returnx);
432         log_println("                resolved branches: %6d", count_branches_resolved);
433         log_println("              unresolved branches: %6d", count_branches_unresolved);
434         dolog("Number of Table    Pseudocommands: %6d", count_pcmd_table);
435         dolog("Number of Useful   Pseudocommands: %6d", count_pcmd_table +
436                   count_pcmd_bra + count_pcmd_load + count_pcmd_mem + count_pcmd_op);
437         dolog("Number of Null Pointer Checks:     %6d", count_check_null);
438         dolog("Number of Array Bound Checks:      %6d", count_check_bound);
439         dolog("Number of Try-Blocks: %d", count_tryblocks);
440
441         dolog("Number of branch_emit (total, 8bit/16bit/32bit/64bit offset): %d, %d/%d/%d/%d",
442                 count_emit_branch,  count_emit_branch_8bit,  count_emit_branch_16bit, 
443                                                         count_emit_branch_32bit, count_emit_branch_64bit);
444
445         dolog("Maximal count of stack elements:   %d", count_max_new_stack);
446         dolog("Upper bound of max stack elements: %d", count_upper_bound_new_stack);
447         dolog("Distribution of stack sizes at block boundary");
448         dolog("     0     1     2     3     4     5     6     7     8     9  >=10");
449         dolog("%6d%6d%6d%6d%6d%6d%6d%6d%6d%6d%6d",
450                   count_block_stack[0], count_block_stack[1], count_block_stack[2],
451                   count_block_stack[3], count_block_stack[4], count_block_stack[5],
452                   count_block_stack[6], count_block_stack[7], count_block_stack[8],
453                   count_block_stack[9], count_block_stack[10]);
454         dolog("Distribution of store stack depth");
455         dolog("     0     1     2     3     4     5     6     7     8     9  >=10");
456         dolog("%6d%6d%6d%6d%6d%6d%6d%6d%6d%6d%6d",
457                   count_store_depth[0], count_store_depth[1], count_store_depth[2],
458                   count_store_depth[3], count_store_depth[4], count_store_depth[5],
459                   count_store_depth[6], count_store_depth[7], count_store_depth[8],
460                   count_store_depth[9], count_store_depth[10]);
461         dolog("Distribution of store creator chains first part");
462         dolog("     0     1     2     3     4     5     6     7     8     9");
463         dolog("%6d%6d%6d%6d%6d%6d%6d%6d%6d%6d",
464                   count_store_length[0], count_store_length[1], count_store_length[2],
465                   count_store_length[3], count_store_length[4], count_store_length[5],
466                   count_store_length[6], count_store_length[7], count_store_length[8],
467                   count_store_length[9]);
468         dolog("Distribution of store creator chains second part");
469         dolog("    10    11    12    13    14    15    16    17    18    19  >=20");
470         dolog("%6d%6d%6d%6d%6d%6d%6d%6d%6d%6d%6d",
471                   count_store_length[10], count_store_length[11],
472                   count_store_length[12], count_store_length[13],
473                   count_store_length[14], count_store_length[15],
474                   count_store_length[16], count_store_length[17],
475                   count_store_length[18], count_store_length[19],
476                   count_store_length[20]);
477         dolog("Distribution of analysis iterations");
478         dolog("     1     2     3     4   >=5");
479         dolog("%6d%6d%6d%6d%6d",
480                   count_analyse_iterations[0], count_analyse_iterations[1],
481                   count_analyse_iterations[2], count_analyse_iterations[3],
482                   count_analyse_iterations[4]);
483
484
485         /* Distribution of basic blocks per method ********************************/
486
487         log_println("Distribution of basic blocks per method:");
488         log_println("   <=5  <=10  <=15  <=20  <=30  <=40  <=50  <=75   >75");
489
490         log_start();
491         for (i = 0; i <= 8; i++)
492                 log_print("%6d", count_method_bb_distribution[i]);
493         log_finish();
494
495         /* print ratio */
496
497         f = (float) count_methods;
498
499         log_start();
500         for (i = 0; i <= 8; i++)
501                 log_print("%6.2f", (float) count_method_bb_distribution[i] / f);
502         log_finish();
503
504         /* print cumulated ratio */
505
506         log_start();
507         for (i = 0, sum = 0; i <= 8; i++) {
508                 sum += count_method_bb_distribution[i];
509                 log_print("%6.2f", (float) sum / f);
510         }
511         log_finish();
512
513
514         /* Distribution of basic block sizes **************************************/
515
516         log_println("Distribution of basic block sizes:");
517         log_println("     0     1     2     3     4     5     6     7     8     9   <13   <15   <17   <19   <21   <26   <31   >30");
518
519         /* print block sizes */
520
521         log_start();
522         for (i = 0; i <= 17; i++)
523                 log_print("%6d", count_block_size_distribution[i]);
524         log_finish();
525
526         /* print ratio */
527
528         f = (float) count_basic_blocks;
529
530         log_start();
531         for (i = 0; i <= 17; i++)
532                 log_print("%6.2f", (float) count_block_size_distribution[i] / f);
533         log_finish();
534
535         /* print cumulated ratio */
536
537         log_start();
538         for (i = 0, sum = 0; i <= 17; i++) {
539                 sum += count_block_size_distribution[i];
540                 log_print("%6.2f", (float) sum / f);
541         }
542         log_finish();
543
544         statistics_print_memory_usage();
545
546         dolog("Number of class loads:    %6d", count_class_loads);
547         dolog("Number of class inits:    %6d", count_class_inits);
548         dolog("Number of loaded Methods: %6d\n", count_all_methods);
549
550         dolog("Calls of utf_new:                 %6d", count_utf_new);
551         dolog("Calls of utf_new (element found): %6d\n", count_utf_new_found);
552
553
554         /* LSRA statistics ********************************************************/
555
556         dolog("Moves reg -> reg:     %6d", count_mov_reg_reg);
557         dolog("Moves mem -> reg:     %6d", count_mov_mem_reg);
558         dolog("Moves reg -> mem:     %6d", count_mov_reg_mem);
559         dolog("Moves mem -> mem:     %6d", count_mov_mem_mem);
560
561         dolog("Methods allocated by LSRA:         %6d",
562                   count_methods_allocated_by_lsra);
563         dolog("Conflicts between local Variables: %6d", count_locals_conflicts);
564         dolog("Local Variables held in Memory:    %6d", count_locals_spilled);
565         dolog("Local Variables held in Registers: %6d", count_locals_register);
566         dolog("Stackslots held in Memory:         %6d", count_ss_spilled);
567         dolog("Stackslots held in Registers:      %6d", count_ss_register);
568         dolog("Memory moves at BB Boundaries:     %6d", count_mem_move_bb);
569         dolog("Number of interface slots:         %6d\n", count_interface_size);
570         dolog("Number of Argument stack slots in register:  %6d",
571                   count_argument_reg_ss);
572         dolog("Number of Argument stack slots in memory:    %6d\n",
573                   count_argument_mem_ss);
574         dolog("Number of Methods kept in registers:         %6d\n",
575                   count_method_in_register);
576
577
578         /* instruction scheduler statistics ***************************************/
579
580 #if defined(USE_SCHEDULER)
581         dolog("Instruction scheduler statistics:");
582         dolog("Number of basic blocks:       %7d", count_schedule_basic_blocks);
583         dolog("Number of nodes:              %7d", count_schedule_nodes);
584         dolog("Number of leaders nodes:      %7d", count_schedule_leaders);
585         dolog("Number of max. leaders nodes: %7d", count_schedule_max_leaders);
586         dolog("Length of critical path:      %7d\n", count_schedule_critical_path);
587 #endif
588
589
590         /* call statistics ********************************************************/
591
592         dolog("Function call statistics:");
593         dolog("Number of jni->CallXMethod function invokations: %ld",
594                   count_jni_callXmethod_calls);
595         dolog("Overall number of jni invokations:               %ld",
596                   count_jni_calls);
597
598         log_println("java-to-native calls:   %10ld", count_calls_java_to_native);
599         log_println("native-to-java calls:   %10ld", count_calls_native_to_java);
600
601
602         /* now print other statistics ********************************************/
603
604 #if defined(ENABLE_INTRP)
605         print_dynamic_super_statistics();
606 #endif
607 }
608
609
610 /* statistics_print_date *******************************************************
611
612    Print current date and time.
613
614 *******************************************************************************/
615
616 void statistics_print_date(void)
617 {
618   time_t t;
619   struct tm tm;
620
621 #if defined(HAVE_TIME)
622   time(&t);
623 #else
624 # error !HAVE_TIME
625 #endif
626
627 #if defined(HAVE_LOCALTIME_R)
628   localtime_r(&t, &tm);
629 #else
630 # error !HAVE_LOCALTIME_R
631 #endif
632
633   log_println("%d-%02d-%02d %02d:%02d:%02d",
634                           1900 + tm.tm_year, tm.tm_mon + 1, tm.tm_mday,
635                           tm.tm_hour, tm.tm_min, tm.tm_sec);
636 }
637
638
639 /* statistics_print_memory_usage ***********************************************
640
641    Print current memory usage.
642
643 *******************************************************************************/
644
645 void statistics_print_memory_usage(void)
646 {
647         s4 sum;
648
649         log_println("memory usage ----------------------");
650         log_println("");
651         log_println("code:                   %10d", count_code_len);
652         log_println("data:                   %10d", count_data_len);
653         log_println("                         ----------");
654
655         sum =
656                 count_code_len +
657                 count_data_len;
658
659         log_println("                        %10d", sum);
660         log_println("");
661         log_println("classinfo  (%3d B):     %10d", (int) sizeof(classinfo), size_classinfo);
662         log_println("fieldinfo  (%3d B):     %10d", (int) sizeof(fieldinfo), size_fieldinfo);
663         log_println("methodinfo (%3d B):     %10d", (int) sizeof(methodinfo), size_methodinfo);
664         log_println("lineinfo   (%3d B):     %10d", (int) sizeof(lineinfo), size_lineinfo);
665         log_println("codeinfo   (%3d B):     %10d", (int) sizeof(codeinfo), size_codeinfo);
666         log_println("                         ----------");
667
668         sum =
669                 size_classinfo +
670                 size_fieldinfo +
671                 size_methodinfo +
672                 size_lineinfo +
673                 size_codeinfo;
674
675         log_println("                        %10d", sum);
676         log_println("");
677         log_println("constant pool:          %10d", count_const_pool_len);
678         log_println("classref:               %10d", count_classref_len);
679         log_println("parsed descriptors:     %10d", count_parsed_desc_len);
680         log_println("vftbl:                  %10d", count_vftbl_len);
681         log_println("compiler stubs:         %10d", count_cstub_len);
682         log_println("native stubs:           %10d", size_stub_native);
683         log_println("utf:                    %10d", count_utf_len);
684         log_println("vmcode:                 %10d", count_vmcode_len);
685         log_println("exception tables:       %10d", count_extable_len);
686         log_println("stack map:              %10d", size_stack_map);
687         log_println("string:                 %10d", size_string);
688         log_println("threadobject:           %10d", size_threadobject);
689         log_println("lock record:            %10d", size_lock_record);
690         log_println("lock hashtable:         %10d", size_lock_hashtable);
691         log_println("lock waiter:            %10d", size_lock_waiter);
692         log_println("                         ----------");
693
694         sum =
695                 count_const_pool_len +
696                 count_classref_len +
697                 count_parsed_desc_len + 
698                 count_vftbl_len +
699                 count_cstub_len +
700                 size_stub_native +
701                 count_utf_len +
702                 count_vmcode_len +
703                 count_extable_len +
704                 size_stack_map +
705                 size_string +
706                 size_threadobject +
707                 size_lock_record +
708                 size_lock_hashtable +
709                 size_lock_waiter;
710
711         log_println("                        %10d", sum);
712         log_println("");
713         log_println("max. code memory:       %10d", maxcodememusage);
714         log_println("max. heap memory:       %10d", maxmemusage);
715         log_println("max. dump memory:       %10d", maxdumpsize);
716         log_println("");
717         log_println("heap memory not freed:  %10d", (s4) memoryusage);
718         log_println("dump memory not freed:  %10d", (s4) globalallocateddumpsize);
719         log_println("");
720 }
721
722
723 /* statistics_print_gc_memory_usage ********************************************
724
725    Print current GC memory usage.
726
727 *******************************************************************************/
728
729 void statistics_print_gc_memory_usage(void)
730 {
731         log_println("GC memory usage -------------------");
732         log_println("");
733         log_println("max. heap size: %10lld", gc_get_max_heap_size());
734         log_println("");
735         log_println("heap size:      %10lld", gc_get_heap_size());
736         log_println("free:           %10lld", gc_get_free_bytes());
737         log_println("used:           %10lld", gc_get_total_bytes());
738         log_println("");
739 }
740
741
742 /*
743  * These are local overrides for various environment variables in Emacs.
744  * Please do not remove this and leave it at the end of the file, where
745  * Emacs will automagically detect them.
746  * ---------------------------------------------------------------------
747  * Local variables:
748  * mode: c
749  * indent-tabs-mode: t
750  * c-basic-offset: 4
751  * tab-width: 4
752  * End:
753  * vim:noexpandtab:sw=4:ts=4:
754  */