Skip to content
This repository has been archived by the owner on Aug 3, 2022. It is now read-only.

Commit

Permalink
Minor bug fix/enhancement for OProfile post-processing tools.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Ben Cheng committed Feb 22, 2010
1 parent d1f0dae commit afec5b9
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 2 deletions.
11 changes: 11 additions & 0 deletions daemon/opd_events.c
Expand Up @@ -142,8 +142,19 @@ struct opd_event * find_counter_event(unsigned long counter)
}

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
}


Expand Down
3 changes: 2 additions & 1 deletion opcontrol/opcontrol.cpp
Expand Up @@ -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;
Expand Down Expand Up @@ -665,6 +665,7 @@ int main(int argc, char * const argv[])
}

if (stop) {
echo_dev("1", 0, "dump", -1);
echo_dev("0", 0, "enable", -1);
}
}
21 changes: 20 additions & 1 deletion opimport_pull
Expand Up @@ -71,7 +71,24 @@ if result != 0:

# 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
Expand All @@ -81,6 +98,8 @@ stream = os.popen("find raw_samples -type f -name \*all")
# 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)
Expand Down

0 comments on commit afec5b9

Please sign in to comment.