Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: statistics.c 7916 2007-05-18 14:24:21Z twisti $
-
*/
#include "config.h"
+#include <stdint.h>
#include <string.h>
#if defined(HAVE_TIME_H)
s4 size_string = 0;
s4 size_threadobject = 0;
+int32_t size_thread_index_t = 0;
+int32_t size_stacksize = 0;
s4 size_lock_record = 0;
s4 size_lock_hashtable = 0;
s4 size_lock_waiter = 0;
+int32_t count_linenumbertable = 0;
+int32_t size_linenumbertable = 0;
+
+s4 size_patchref = 0;
+
+s4 size_cachedref = 0;
+
+u8 count_calls_java_to_native = 0;
+u8 count_calls_native_to_java = 0;
+
int count_const_pool_len = 0;
int count_classref_len = 0;
int count_parsed_desc_len = 0;
int count_jit_calls = 0;
int count_methods = 0;
-int count_spills = 0;
-int count_spills_read = 0;
+int count_spills_read_ila = 0;
+int count_spills_read_flt = 0;
+int count_spills_read_dbl = 0;
+int count_spills_write_ila = 0;
+int count_spills_write_flt = 0;
+int count_spills_write_dbl = 0;
int count_pcmd_activ = 0;
int count_pcmd_drop = 0;
int count_pcmd_zero = 0;
int count_max_new_stack = 0;
int count_upper_bound_new_stack = 0;
+int count_emit_branch = 0;
+int count_emit_branch_8bit = 0;
+int count_emit_branch_16bit = 0;
+int count_emit_branch_32bit = 0;
+int count_emit_branch_64bit = 0;
+
s4 count_branches_resolved = 0;
s4 count_branches_unresolved = 0;
-u8 count_native_function_calls=0;
u8 count_jni_callXmethod_calls=0;
u8 count_jni_calls=0;
s4 count_schedule_critical_path = 0;
-/* nativeinvokation ***********************************************************
-
- increments the native invokation count by one
-
-*******************************************************************************/
-
-void nativeinvokation(void)
-{
- /* XXX do locking here */
- count_native_function_calls++;
-}
-
-
/* jnicallXmethodinvokation ***************************************************
increments the jni CallXMethod invokation count by one
dolog("Size of compiled Exception Tables: %d", count_javaexcsize);
dolog("Number of Machine-Instructions: %d", count_code_len >> 2);
- dolog("Number of Spills (write to memory): %d", count_spills);
- dolog("Number of Spills (read from memory): %d", count_spills_read);
+ dolog("Number of Spills (write to memory) <all [i/l/a|flt|dbl]>: %d [%d|%d|%d]",
+ count_spills_write_ila + count_spills_write_flt + count_spills_write_dbl,
+ count_spills_write_ila, count_spills_write_flt, count_spills_write_dbl);
+ dolog("Number of Spills (read from memory) <all [i/l/a|flt|dbl]>: %d [%d|%d|%d]",
+ count_spills_read_ila + count_spills_read_flt + count_spills_read_dbl,
+ count_spills_read_ila, count_spills_read_flt, count_spills_read_dbl);
dolog("Number of Activ Pseudocommands: %6d", count_pcmd_activ);
dolog("Number of Drop Pseudocommands: %6d", count_pcmd_drop);
dolog("Number of Const Pseudocommands: %6d (zero:%5d)",
dolog("Number of Null Pointer Checks: %6d", count_check_null);
dolog("Number of Array Bound Checks: %6d", count_check_bound);
dolog("Number of Try-Blocks: %d", count_tryblocks);
+
+ dolog("Number of branch_emit (total, 8bit/16bit/32bit/64bit offset): %d, %d/%d/%d/%d",
+ count_emit_branch, count_emit_branch_8bit, count_emit_branch_16bit,
+ count_emit_branch_32bit, count_emit_branch_64bit);
+
dolog("Maximal count of stack elements: %d", count_max_new_stack);
dolog("Upper bound of max stack elements: %d", count_upper_bound_new_stack);
dolog("Distribution of stack sizes at block boundary");
/* call statistics ********************************************************/
dolog("Function call statistics:");
- dolog("Number of native function invokations: %ld",
- count_native_function_calls);
dolog("Number of jni->CallXMethod function invokations: %ld",
count_jni_callXmethod_calls);
dolog("Overall number of jni invokations: %ld",
count_jni_calls);
+ log_println("java-to-native calls: %10ld", count_calls_java_to_native);
+ log_println("native-to-java calls: %10ld", count_calls_native_to_java);
+
/* now print other statistics ********************************************/
log_println("memory usage ----------------------");
log_println("");
- log_println("code: %10d", count_code_len);
- log_println("data: %10d", count_data_len);
- log_println(" ----------");
+ log_println("code: %10d", count_code_len);
+ log_println("data: %10d", count_data_len);
+ log_println(" ----------");
sum =
count_code_len +
count_data_len;
- log_println(" %10d", sum);
+ log_println(" %10d", sum);
+
log_println("");
- log_println("classinfo (%3d B): %10d", (int) sizeof(classinfo), size_classinfo);
- log_println("fieldinfo (%3d B): %10d", (int) sizeof(fieldinfo), size_fieldinfo);
- log_println("methodinfo (%3d B): %10d", (int) sizeof(methodinfo), size_methodinfo);
- log_println("lineinfo (%3d B): %10d", (int) sizeof(lineinfo), size_lineinfo);
- log_println("codeinfo (%3d B): %10d", (int) sizeof(codeinfo), size_codeinfo);
- log_println(" ----------");
+
+ log_println("classinfo (%3d B): %10d", (int) sizeof(classinfo), size_classinfo);
+ log_println("fieldinfo (%3d B): %10d", (int) sizeof(fieldinfo), size_fieldinfo);
+ log_println("methodinfo (%3d B): %10d", (int) sizeof(methodinfo), size_methodinfo);
+ log_println("lineinfo (%3d B): %10d", (int) sizeof(lineinfo), size_lineinfo);
+ log_println("codeinfo (%3d B): %10d", (int) sizeof(codeinfo), size_codeinfo);
+ log_println(" ----------");
sum =
size_classinfo +
size_lineinfo +
size_codeinfo;
- log_println(" %10d", sum);
+ log_println(" %10d", sum);
+
+ log_println("");
+
+ log_println("linenumber tables (%5d): %10d", count_linenumbertable, size_linenumbertable);
+ log_println("exception tables: %10d", count_extable_len);
+ log_println("patcher references: %10d", size_patchref);
+ log_println("cached references: %10d", size_cachedref);
+ log_println(" ----------");
+
+ sum =
+ size_linenumbertable +
+ count_extable_len +
+ size_patchref +
+ size_cachedref;
+
+ log_println(" %10d", sum);
+
log_println("");
- log_println("constant pool: %10d", count_const_pool_len);
- log_println("classref: %10d", count_classref_len);
- log_println("parsed descriptors: %10d", count_parsed_desc_len);
- log_println("vftbl: %10d", count_vftbl_len);
- log_println("compiler stubs: %10d", count_cstub_len);
- log_println("native stubs: %10d", size_stub_native);
- log_println("utf: %10d", count_utf_len);
- log_println("vmcode: %10d", count_vmcode_len);
- log_println("exception tables: %10d", count_extable_len);
- log_println("stack map: %10d", size_stack_map);
- log_println("string: %10d", size_string);
- log_println("threadobject: %10d", size_threadobject);
- log_println("lock record: %10d", size_lock_record);
- log_println("lock hashtable: %10d", size_lock_hashtable);
- log_println("lock waiter: %10d", size_lock_waiter);
- log_println(" ----------");
+
+ log_println("constant pool: %10d", count_const_pool_len);
+ log_println("classref: %10d", count_classref_len);
+ log_println("parsed descriptors: %10d", count_parsed_desc_len);
+ log_println("vftbl: %10d", count_vftbl_len);
+ log_println("compiler stubs: %10d", count_cstub_len);
+ log_println("native stubs: %10d", size_stub_native);
+ log_println("utf: %10d", count_utf_len);
+ log_println("vmcode: %10d", count_vmcode_len);
+ log_println("stack map: %10d", size_stack_map);
+ log_println("string: %10d", size_string);
+ log_println("threadobject: %10d", size_threadobject);
+ log_println("thread index: %10d", size_thread_index_t);
+ log_println("stack size: %10d", size_stacksize);
+ log_println("lock record: %10d", size_lock_record);
+ log_println("lock hashtable: %10d", size_lock_hashtable);
+ log_println("lock waiter: %10d", size_lock_waiter);
+ log_println(" ----------");
sum =
count_const_pool_len +
size_stub_native +
count_utf_len +
count_vmcode_len +
- count_extable_len +
size_stack_map +
size_string +
size_threadobject +
+ size_thread_index_t +
+ size_stacksize +
size_lock_record +
size_lock_hashtable +
size_lock_waiter;
- log_println(" %10d", sum);
+ log_println(" %10d", sum);
+
log_println("");
- log_println("max. memory usage: %10d", maxcodememusage);
- log_println("max. heap memory usage: %10d", maxmemusage);
- log_println("max. dump memory usage: %10d", maxdumpsize);
+
+ log_println("max. code memory: %10d", maxcodememusage);
+ log_println("max. heap memory: %10d", maxmemusage);
+ log_println("max. dump memory: %10d", maxdumpsize);
log_println("");
- log_println("heap memory not freed: %10d", (s4) memoryusage);
- log_println("dump memory not freed: %10d", (s4) globalallocateddumpsize);
+ log_println("heap memory not freed: %10d", (int32_t) memoryusage);
+ log_println("dump memory not freed: %10d", (int32_t) globalallocateddumpsize);
+
log_println("");
}
void statistics_print_gc_memory_usage(void)
{
- log_println("GC memory usage -------------------");
- log_println("");
- log_println("max. heap size: %10lld", gc_get_max_heap_size());
- log_println("");
- log_println("heap size: %10lld", gc_get_heap_size());
- log_println("free: %10lld", gc_get_free_bytes());
- log_println("used: %10lld", gc_get_total_bytes());
- log_println("");
+ static int64_t count = 0;
+ int64_t max;
+ int64_t size;
+ int64_t free;
+ int64_t used;
+ int64_t total;
+
+ count++;
+
+ max = gc_get_max_heap_size();
+ size = gc_get_heap_size();
+ free = gc_get_free_bytes();
+ used = size - free;
+ total = gc_get_total_bytes();
+
+ if (opt_ProfileMemoryUsageGNUPlot) {
+ if (count == 1)
+ fprintf(opt_ProfileMemoryUsageGNUPlot, "plot \"profile.dat\" using 1:2 with lines title \"max. Java heap size\", \"profile.dat\" using 1:3 with lines title \"Java heap size\", \"profile.dat\" using 1:4 with lines title \"used\", \"profile.dat\" using 1:5 with lines title \"free\"\n");
+
+#if SIZEOF_VOID_P == 8
+ fprintf(opt_ProfileMemoryUsageGNUPlot, "%ld %ld %ld %ld %ld\n", count, max, size, used, free);
+#else
+ fprintf(opt_ProfileMemoryUsageGNUPlot, "%lld %lld %lld %lld %lld\n", count, max, size, used, free);
+#endif
+
+ fflush(opt_ProfileMemoryUsageGNUPlot);
+ }
+ else {
+ log_println("GC memory usage -------------------");
+ log_println("");
+ log_println("max. Java heap size: %10lld", max);
+ log_println("");
+ log_println("Java heap size: %10lld", size);
+ log_println("used: %10lld", used);
+ log_println("free: %10lld", free);
+ log_println("totally used: %10lld", total);
+ log_println("");
+ }
}