OSDN Git Service

Print callee information in the JIT profile outout
authorBen Cheng <bccheng@android.com>
Fri, 6 Aug 2010 23:42:50 +0000 (16:42 -0700)
committerBen Cheng <bccheng@android.com>
Fri, 6 Aug 2010 23:42:50 +0000 (16:42 -0700)
For example:
TRACEPROFILE 0x48bbb2d4      11057  0.55% [0x45d(+1), 14011] ...
    -> Ljava/util/HashMap$HashIterator;hasNext;()Z

It means the trace ends with a call to hasNext(), and inlining
probably won't help the overall performance more than 0.55%.

Change-Id: I9bf2a79c48d6cb569a9fe2e329022edf968664bb

vm/compiler/codegen/arm/Assemble.c

index 58150d8..226a942 100644 (file)
@@ -1847,6 +1847,7 @@ static int dumpTraceProfile(JitEntry *p, bool silent, bool reset,
     u2* pCellOffset;
     JitTraceDescription *desc;
     const Method* method;
+    int idx;
 
     traceBase = getTraceBase(p);
 
@@ -1900,6 +1901,24 @@ static int dumpTraceProfile(JitEntry *p, bool silent, bool reset,
          method->clazz->descriptor, method->name, methodDesc);
     free(methodDesc);
 
+    /* Find the last fragment (ie runEnd is set) */
+    for (idx = 0;
+         desc->trace[idx].frag.isCode && !desc->trace[idx].frag.runEnd;
+         idx++) {
+    }
+
+    /*
+     * runEnd must comes with a JitCodeDesc frag. If isCode is false it must
+     * be a meta info field (only used by callsite info for now).
+     */
+    if (!desc->trace[idx].frag.isCode) {
+        const Method *method = desc->trace[idx+1].meta;
+        char *methodDesc = dexProtoCopyMethodDescriptor(&method->prototype);
+        /* Print the callee info in the trace */
+        LOGD("    -> %s%s;%s", method->clazz->descriptor, method->name,
+             methodDesc);
+    }
+
     return executionCount;
 }