Fixes in tapsets and tapscripts for Java default tip
authorJan Vrany <jan.vrany@fit.cvut.cz>
Fri, 19 Jun 2015 08:46:40 +0100
changeset 5 370848e6fc80
parent 4 ca45a88235bd
Fixes in tapsets and tapscripts for Java
tapscripts/stx-jvm-count-checkcast-and-instanceof.stp
tapscripts/stx-jvm-stats.stp
tapset/stx_libjava.stp
tapset/stx_librun.stp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tapscripts/stx-jvm-count-checkcast-and-instanceof.stp	Fri Jun 19 08:46:40 2015 +0100
@@ -0,0 +1,33 @@
+global count;
+global count_checkcast;
+global count_instanceof;
+
+/*
+probe stx.librun.statement("__jInterpret@jinterpret.c:1752"){
+	count <<< 1
+}
+*/
+
+
+probe stx.librun.function("___checkcast") {
+	count_checkcast <<< 1
+}
+
+probe stx.librun.function("___checkcast_r") {
+	count_checkcast <<< 1
+}
+
+probe stx.librun.function("___instanceof") {
+	count_instanceof <<< 1
+}
+
+probe stx.librun.function("___instanceof_r") {
+	count_instanceof <<< 1
+}
+
+
+probe end {
+    printf("# of all insns       : %d\n", @sum(count));
+    printf("# of CHECKCAST  insns: %d\n", @sum(count_checkcast));
+    printf("# of INSTANCEOF insns: %d\n", @sum(count_instanceof));
+}
\ No newline at end of file
--- a/tapscripts/stx-jvm-stats.stp	Thu Apr 09 15:04:14 2015 +0100
+++ b/tapscripts/stx-jvm-stats.stp	Fri Jun 19 08:46:40 2015 +0100
@@ -1,58 +1,57 @@
 global stats;
-#global methods;
+//global jcompile_failures;
 
-probe stx.jvm.monitorenter {
-    if ( pid() != target() ) next;
+probe stx.jvm.monitorenter {        
     stats["MONITOR ENTER"] <<< 1;
 }
 
-probe stx.jvm.monitorenter.fat {
-    if ( pid() != target() ) next;
+probe stx.jvm.monitorenter.fat {        
     stats["MONITOR ENTER (fat)"] <<< 1;
 }
 
-probe stx.jvm.monitorexit {
-    if ( pid() != target() ) next;
+probe stx.jvm.monitorexit {        
     stats["MONITOR EXIT"] <<< 1;
 }
 
-probe stx.jvm.monitorexit.fat {
-    if ( pid() != target() ) next;
+probe stx.jvm.monitorexit.fat {    
     stats["MONITOR EXIT (fat)"] <<< 1;
 }
 
-probe stx.jvm.throw {
-    if ( pid() != target() ) next;
+probe stx.jvm.throw {    
     stats["Exceptions thrown"] <<< 1;
 }
 
-probe stx.jvm.method.interpret {
-    if ( pid() != target() ) next;
+probe stx.jvm.interpreter.method {    
     stats["Methods interpreted"] <<< 1;
-
-#   if (! methods[$__selector] ) {
-#        methods[$__selector] = 1;
-#        stats["Methods interpreted (distinct)"] <<< 1;
-#    }
-
 }
 
-probe stx.jvm.class.loaded {
-    if ( pid() != target() ) next;
+#probe stx.jvm.interpreter.bytecode {
+#    stats["Bytecodes executed"] <<< $bc;
+#}
+
+probe stx.jvm.compiler.compile.finished {
+	stats["Methods compiled"] <<< 1;	
+}
+
+probe stx.jvm.compiler.compile.failed {
+	stats["Methods compiled (and failed)"] <<< 1;	
+	printf("Method failed to compile: %s#%s\n", user_string($arg1), user_string($arg2));
+}
+
+
+probe stx.jvm.class.loaded {    
     stats["Classes loaded"] <<< 1;
 }
 
 
 
 probe stx.gc.scavenge.end {
-    if ( pid() != target() ) next;
-
     freed = @cast(@var("P__newEndPtr@globals.c"), "int") - @cast(@var("P__newNextPtr@globals.c"), "int")
     stats["Scavenge"] <<< freed;
 }
 
 
-function print_counter(name) {    
+function print_cnt(name) {    
     printf("  %-35s : %10d\n", name, @count(stats[name]));
 }
 
@@ -60,32 +59,42 @@
     printf("  %-29s (avg) : %10d\n", name, @avg(stats[name]));
 }
 
+#function print_sum(name) {    
+#    printf("  %-29s (sum) : %10d\n", name, @sum(stats[name]));
+#}
+
 probe end {
     
     printf("=== STX-JVM Performance Statistics ===\n");
     printf("\n");
-
     printf(" -- Execution --\n");
-    print_counter("Methods interpreted");
- #   print_counter("Methods interpreted (distinct)");
+    print_cnt("Methods interpreted");
+    print_cnt("Bytecodes interpreted");    
     printf("\n");
 
+	printf(" -- Compilation --\n");
+	print_cnt("Methods compiled");
+	print_cnt("Methods compiled (and failed)")
+	printf("\n");
+
     printf(" -- Classes --\n");
-    print_counter("Classes loaded");
+    print_cnt("Classes loaded");
     printf("\n");
 
     printf(" -- Exceptions --\n");
-    print_counter("Exceptions thrown");
+    print_cnt("Exceptions thrown");
     printf("\n");
 
     printf(" -- Monitors --\n");
-    print_counter("MONITOR ENTER");
-    print_counter("MONITOR ENTER (fat)");
-    print_counter("MONITOR EXIT");
-    print_counter("MONITOR EXIT (fat)");
+    print_cnt("MONITOR ENTER");    
+    print_cnt("MONITOR ENTER (fat)");
+    print_cnt("MONITOR EXIT");
+    print_cnt("MONITOR EXIT (fat)");
+
     printf("\n");
 
     printf(" -- GC --\n");
-    print_counter("Scavenge");
+    print_cnt("Scavenge");
     print_avg("Scavenge");
+    printf("\n");
 }
\ No newline at end of file
--- a/tapset/stx_libjava.stp	Thu Apr 09 15:04:14 2015 +0100
+++ b/tapset/stx_libjava.stp	Fri Jun 19 08:46:40 2015 +0100
@@ -3,7 +3,7 @@
 #
 
 
-probe stx.libjava = process("libstx_libjava.so") {}
+probe stx.libjava = process.library("libstx_libjava.so") { }
 
 
 probe stx.jvm.monitorenter.fat = stx.libjava.function("*_JavaVM___137MONITORENTER_") { }
--- a/tapset/stx_librun.stp	Thu Apr 09 15:04:14 2015 +0100
+++ b/tapset/stx_librun.stp	Fri Jun 19 08:46:40 2015 +0100
@@ -3,13 +3,18 @@
 #
 
 
-probe stx.librun = process("librun.so") {}
+probe stx.librun = process.library("librun.so") {}
 
 
 probe stx.jvm.monitorenter = stx.librun.function("__monitorEnter") { }
 probe stx.jvm.monitorexit  = stx.librun.function("__monitorExit") { }
 
-probe stx.jvm.method.interpret = stx.librun.function("__jInterpret") { }
+probe stx.jvm.interpreter.method = stx.librun.function("__jInterpret") { }
+
+probe stx.jvm.compiler.compile = stx.librun.mark("stx_librun_mcompiler_jcompile") {}
+probe stx.jvm.compiler.compile.finished = stx.librun.mark("stx_librun_mcompiler_jcompile_finished") {}
+probe stx.jvm.compiler.compile.failed = stx.librun.mark("stx_librun_mcompiler_jcompile_failed") {}
+
 
 
 probe stx.gc.scavenge.begin = stx.librun.function("scavenge") { }