Finally I managed to get OProfile running on my N800, it was not that easy, so I'm blogging about it to save your time. Packages are provided at: http://arm1136j-s.googlecode.com/svn/trunk/maemo/utils/oprofile/
Steps:
- recompile your kernel following official maemo howto. I've set:
CONFIG_PROFILING=y
CONFIG_OPROFILE=y
CONFIG_DEBUG_FS=y
- flash your new kernel with:
flasher-3.0 -f -k arch/arm/boot/zImage
- download and compile binutils. It's development files are missing in scratchbox, so you need to download it and compile yourself. I've downloaded sardine version:
wget http://repository.maemo.org/pool/sardine/main/source/b/binutils/binutils_2.16.91cs2005q3.2-5.osso1.tar.gz
tar xzf binutils_2.16.91cs2005q3.2-5.osso1.tar.gz
cd binutils-2.16.91cs2005q3.2
./configure --prefix=/usr/local && make && make install
- download last user land OProfile CVS (0.9.2 didn't work for me).
cvs -d:pserver:anonymous@oprofile.cvs.sourceforge.net:/cvsroot/oprofile login # no password, just hit ENTER
cvs -d:pserver:anonymous@oprofile.cvs.sourceforge.net:/cvsroot/oprofile checkout oprofile
- apply patch to enable arm11 support to user land OProfile CVS. This patch was provided by Riku Voipio but doesn't apply to CVS (2007-05-22), use my fixed version instead: oprofile_arm11_cvs20070522.diff
- configure:
./autogen.sh && ./configure --with-binutils=/usr/local --with-kernel-support --prefix=/usr/local
- create "package" with files to copy to device:
make DESTDIR=/tmp/oprofile-install install && cd /tmp/oprofile-install && tar czf /tmp/oprofile-install.tar.gz .
- on your device, insert a MMC with good amount of room (64mb or more), and link /var/lib/oprofile to it:
mkdir /media/mmc1/oprofile
ln -sf /media/mmc1/oprofile /var/lib/oprofile
- I use the following /root/.oprofile/daemonrc (for some strange reason the last KERNEL_RANGE value was not being computed as the script expected and I could not set SEPARATE_LIB using "--separate=library"):
KERNEL_RANGE=c0023000,80046000
SEPARATE_LIB=1
Binary package oprofile_0.9.3_cvs20070522.deb already provides /root/.oprofile/daemonrc, setups /var/lib/oprofile link to available MMC and also provides /root/vmlinux with debug symbols.
On my desktop I use kcachegrind to present data in more pleasant way, just use op2calltree
to convert output from opreport -gdf
.
UPDATE-2007-07-11: Eugene is working on Kprobes and SystemTap for N800, check it at his blog http://eugeneteo.livejournal.com/7002.html and http://eugeneteo.livejournal.com/6172.html