I've been trying to get oprofile working on a Nexus One handset, but
I'm running into difficulties. I think I'm configuring it correctly
but it doesn't collect any samples.
Here's the process I've been following:
1- Rebuild the kernel (the android-msm-2.6.32-nexusonec branch from
git://android.git.kernel.org/kernel/msm.git) with profiling support
turned on. (Initially the new kernel was too large. I fixed this by
turning off the camera driver and the EXT2/EXT3 file systems.)
2- Rebuild Froyo using the new kernel (by adding a suitable definition
of TARGET_PREBUILT_KERNEL to .../passion-common/passion.mk).
3- Flash new image onto the device. Verify that it's using the kernel
I just built by checking Settings -> About phone -> Kernel version.
4- Connect to the device using "adb shell" and enter "su" to get a
root prompt.
5- Configure and start oprofile:
# opcontrol --setup
# cat /dev/oprofile/cpu_type
arm/armv7#
# opcontrol --event=CPU_CYCLES:100000
Using 2.6+ OProfile kernel interface.
Using log file /data/oprofile/samples/oprofiled.log
# opcontrol --start
# opcontrol --status
Driver directory: /dev/oprofile
Session directory: /data/oprofile
Counter 0:
name: CPU_CYCLES
count: 100000
Counter 1 disabled
Counter 2 disabled
Counter 3 disabled
Counter 4 disabled
oprofiled pid: 373
profiler is running
0 samples received
0 samples lost overflow
So it looks like oprofile is available and enabled in the kernel, but
no samples are being collected.
After using the phone for a while "opcontrol --status" still reports
no samples:
# opcontrol --status
Driver directory: /dev/oprofile
Session directory: /data/oprofile
Counter 0:
name: CPU_CYCLES
count: 100000
Counter 1 disabled
Counter 2 disabled
Counter 3 disabled
Counter 4 disabled
oprofiled pid: 373
profiler is running
0 samples received
0 samples lost overflow
Using Eclair on a HTC Magic, and using "--event=INSN_EXECUTED:500000"
instead of "CPU_CYCLES" I've been able to collect meaningful profile
results, however I'm specifically interested in getting results on a
Nexus One, and nothing I've tried so far has worked.
I've also tried using the Cyanogenmod Eclair release but that fails to
work too, in exactly the same way.
Has anyone had any success getting oprofile to work with Froyo on a
Nexus One? Can anyone suggest anything I should try?
Regards
Mike Playle
RealVNC
--
You received this message because you are subscribed to the Google Groups "android-platform" group.
To post to this group, send email to android-...@googlegroups.com.
To unsubscribe from this group, send email to android-platfo...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/android-platform?hl=en.
It fails with a "remount failed: Operation not permitted" error.
I tried doing the remount from the device's shell - as I understand
it this should be equivalent to "adb remount":
# mount -o remount,rw /dev/block/mtdblock3 /system
But this doesn't help. :(
> BTW, if CPU_CYCLES is the only event type you care about, you can also
> try to combine the --setup and --event options with a single
> "opcontrol --quick" step.
This has the same effect - it appears to start, but doesn't actually
collect any samples.
Thanks for your help,
Mike
Thanks for your help,
Mike
I've got this working now.
The main problem was that the kernel driver wasn't registering an
interrupt handler for the performance monitoring hardware. The fix for
this is on Gerrit here:
https://review.source.android.com/15707
I've also made a fix to the 'opcontrol' tool so that it creates its
directories with sensible permissions:
https://review.source.android.com/15709
Anyway with these two patches oprofile appears to be working fine
for me under Froyo on the Nexus One.
Hope this helps,
Mike Playle
RealVNC
I'm not sure what's changed in the last week and a half but
interestingly it's not working for me now either.
>From a quick look it seems that something else is changing the
performance counter registers between armv7_setup_pmnc() and
armv7_pmnc_start(). I've managed to get it collecting samples
again by adding a call to armv7_setup_pmnc() at the end of
armv7_pmnc_start(), just before it calls armv7_start_pmnc():
ret = armv7_request_interrupts(irqs, ARRAY_SIZE(irqs));
if (ret >= 0) {
armv7_setup_pmnc();
armv7_start_pmnc();
}
Of course this isn't a real fix - the real fix is to find out
what's changing the registers - but this quick hack is at least
letting me collect samples, and unfortunately I don't have the
time at the moment to look into it any more deeply.
I just wish I knew why I wasn't seeing this a week ago!
Hope this helps
Mike