changeset 4:0ac082b5cb28

Clean up summary view Include full class/method signature and include unit for time.
author Omair Majid <omajid@redhat.com>
date Mon, 25 Aug 2014 17:28:12 -0400
parents ae0095fba08f
children 28d99847408a
files agent/ProfileUsingJavassist.java
diffstat 1 files changed, 4 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/agent/ProfileUsingJavassist.java	Mon Aug 25 15:26:39 2014 -0400
+++ b/agent/ProfileUsingJavassist.java	Mon Aug 25 17:28:12 2014 -0400
@@ -83,9 +83,10 @@
             public void run() {
                 System.out.println("=====");
                 System.out.println("Collected stats");
+                System.out.format("%100s\t%15s%n", "Method", "Total time (ns)");
                 Map<String, AtomicLong> data = Profiler.getInstance().getData();
                 for (Map.Entry<String, AtomicLong> entry : data.entrySet()) {
-                    System.out.format("\t%s\t\t\t%20d%n", entry.getKey(), entry.getValue().get());
+                    System.out.format("%100s\t%15d%n", entry.getKey(), entry.getValue().get());
                 }
                 System.out.println("=====");
             }
@@ -146,13 +147,13 @@
             try {
                 CtClass klass = classPool.get(className);
                 for (CtMethod method : klass.getDeclaredMethods()) {
-                    String methodName = method.getName();
+                    String name = method.getLongName();
                     int modifiers = method.getModifiers();
                     if (!Modifier.isAbstract(modifiers) &&
                             !Modifier.isNative(modifiers)) {
                         method.addLocalVariable(PREFIX + "StartTime", CtClass.longType);
                         method.insertBefore(PREFIX + "StartTime = System.nanoTime();");
-                        method.insertAfter("ProfileUsingJavassist.Profiler.getInstance().addData(\"" + className + "." + methodName + "\", (System.nanoTime() - " + PREFIX + "StartTime));");
+                        method.insertAfter("ProfileUsingJavassist.Profiler.getInstance().addData(\"" + name + "\", (System.nanoTime() - " + PREFIX + "StartTime));");
                     }
                 }
                 return klass.toBytecode();