aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNarayan Kamath <narayan@google.com>2011-08-16 17:53:51 +0100
committerNarayan Kamath <narayan@google.com>2011-08-17 10:12:38 +0100
commita2e215abe628d95138749a4813575f8882c1efd0 (patch)
tree749a9c8d019f030e506d0bedbbf070fe70d89b80
parent801d6dd1bc0b65b8b26c03713592d717877e6d60 (diff)
downloadoprofile-a2e215abe628d95138749a4813575f8882c1efd0.tar.gz
The typo (in specifying the --kernel-range argument) completely breaks kernel profiling because the kernel end address will always be 0 and < the start address. All kernel samples will therefore be discarded. I've also added very basic support for turning on kernel profiling via this script. Change-Id: I64b4063cb994ca94a51ed5aa0159aa4ae1627969
-rwxr-xr-xoprofile_android14
1 files changed, 12 insertions, 2 deletions
diff --git a/oprofile_android b/oprofile_android
index 4e05090..8527499 100755
--- a/oprofile_android
+++ b/oprofile_android
@@ -116,6 +116,9 @@ class Tool:
print " (not supported on all devices)"
print " -c, --callgraph=[depth] : specify callgraph capture depth, default is none"
print " (not supported in timer mode)"
+ print " -k, --kernel-image : specifies the location of a kernel image relative to the symbols directory"
+ print " (and turns on kernel profiling). This need not be the same as the"
+ print " location of the kernel on the actual device."
print
print " shutdown : shutdown profiler"
print
@@ -193,11 +196,13 @@ class Tool:
def do_setup(self, command_args):
events = []
timer = False
+ kernel = False
+ kernel_image = ''
callgraph = None
try:
opts, args = getopt.getopt(command_args,
- 'te:c:', ['timer', 'event=', 'callgraph='])
+ 'te:c:k:', ['timer', 'event=', 'callgraph=', 'kernel='])
except getopt.GetoptError, e:
print '* Unsupported setup command arguments:', str(e)
return 2
@@ -209,6 +214,9 @@ class Tool:
events.append('--event=' + a)
elif o in ('-c', '--callgraph'):
callgraph = a
+ elif o in ('-k', '--kernel'):
+ kernel = True
+ kernel_image = a
if len(args) != 0:
print '* Unsupported setup command arguments: %s' % (' '.join(args))
@@ -231,6 +239,8 @@ class Tool:
opcontrol_args.append('--timer')
if callgraph is not None:
opcontrol_args.append('--callgraph=' + callgraph)
+ if kernel and len(kernel_image) != 0:
+ opcontrol_args.append('--vmlinux=' + kernel_image)
# Get kernal VMA range.
rc, output = self.adb.shell(['cat', '/proc/kallsyms'], echo=False)
@@ -244,7 +254,7 @@ class Tool:
# Setup the profiler.
rc, output = self.adb.shell(['/system/xbin/opcontrol'] + self._opcontrol_verbose_arg() + [
'--reset',
- '--kernel-range=' + vma_start + '-' + vma_end] + opcontrol_args + [
+ '--kernel-range=' + vma_start + ',' + vma_end] + opcontrol_args + [
'--setup',
'--status', '--verbose-log=all'])
if rc != 0: