Minor bug fix/enhancement for OProfile post-processing tools.
1) Display samples collected in the code cache into dalvik-jit-code-cache.
2) Tolerate phantom event on counter 3 when it is not configured.
diff --git a/daemon/opd_events.c b/daemon/opd_events.c
index b544fb3..fa017e4 100644
--- a/daemon/opd_events.c
+++ b/daemon/opd_events.c
@@ -142,8 +142,19 @@
}
fprintf(stderr, "Unknown event for counter %lu\n", counter);
+ /*
+ * ANDROID FIXME - from time to time there seems to be 1 phantom event
+ * reported from counter 3 when only counter 0 is enabled. Instead of
+ * crashing the daemon and losing tons of useful samples, we just
+ * charge the erroneous single count to the first event.
+ */
+#ifdef ANDROID
+ return &opd_events[0];
+#else
abort();
return NULL;
+
+#endif
}
diff --git a/opcontrol/opcontrol.cpp b/opcontrol/opcontrol.cpp
index 2558760..5dffe24 100644
--- a/opcontrol/opcontrol.cpp
+++ b/opcontrol/opcontrol.cpp
@@ -45,7 +45,7 @@
int min_count[MAX_EVENTS] = {150000, 200000, 250000};
#else
#define MAX_EVENTS 5
-int min_count[MAX_EVENTS] = {150000, 200000, 250000, 300000, 350000};
+int min_count[MAX_EVENTS] = {150000, 20000, 25000, 30000, 35000};
#endif
int list_events;
@@ -665,6 +665,7 @@
}
if (stop) {
+ echo_dev("1", 0, "dump", -1);
echo_dev("0", 0, "enable", -1);
}
}
diff --git a/opimport_pull b/opimport_pull
index e61d3e5..ed820f0 100755
--- a/opimport_pull
+++ b/opimport_pull
@@ -71,7 +71,24 @@
# enter the destination directory
os.chdir(output_dir)
-stream = os.popen("find raw_samples -type f -name \*all")
+
+# We need to replace the " (deleted)" part in the directory names if
+# the region is allocated through ashmem. The post-processing tool doesn't like
+# space and parentheses.
+# Rename each individual directory from the longest first
+# For example, first rename
+# raw_samples/current/{root}/dev/ashmem/dalvik-jit-code-cache (deleted)/{dep}/{root}/dev/ashmem/dalvik-jit-code-cache (deleted)
+# to
+# raw_samples/current/{root}/dev/ashmem/dalvik-jit-code-cache (deleted)/{dep}/{root}/dev/ashmem/dalvik-jit-code-cache
+# then to
+# raw_samples/current/{root}/dev/ashmem/dalvik-jit-code-cache/{dep}/{root}/dev/ashmem/dalvik-jit-code-cache
+deleted_pattern = re.compile(" \(deleted\)$");
+stream = os.popen("find raw_samples -type d -name \*\ \(deleted\)\* | sort -r")
+for line in stream:
+ line = line.rstrip()
+ new_dir = deleted_pattern.sub("", line)
+ cmd = "mv " + "\"" + line + "\" \"" + new_dir + "\""
+ os.system(cmd)
# now all the sample files are on the host, we need to invoke opimport one at a
# time to convert the content from the ARM abi to x86 ABI
@@ -81,6 +98,8 @@
# 2: intermediate dirs: "/blah/blah/blah"
# 3: filename: e.g. "CPU_CYCLES.150000.0.all.all.all"
pattern = re.compile("(^raw_samples)(.*)/(.*)$")
+
+stream = os.popen("find raw_samples -type f -name \*all")
for line in stream:
match = pattern.search(line)
leading_dir = match.group(1)