Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fix a typo in oprofile_android

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
  • Loading branch information...
commit a2e215abe628d95138749a4813575f8882c1efd0 1 parent 801d6dd
@narayank narayank authored
Showing with 12 additions and 2 deletions.
  1. +12 −2 oprofile_android
View
14 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:
Please sign in to comment.
Something went wrong with that request. Please try again.