Experiences getting OProfile working on OLPC machine

William Cohen wcohen at redhat.com
Mon Mar 12 15:06:42 EDT 2007


Hi All,

I recieved a OLPC Beta 2 machine Thursday. I am am interested in
improving the usability of the performance tools, packages such
OProfile and SystemTap.  I was able to get OProfile working in timer
mode on the machine Friday. Below is an outline of the steps
I went through to get OProfile working on the OLPC machine:

       -get kernel-2.6.21-20070305.1.olpc.50cf80cc481096c.src.rpm from:
       http://dev.laptop.org/~dilinger/SRPMS/

       -install the kernel source on an i686 development machine
       rpm -Uvh kernel-2.6.21-20070305.1.olpc.50cf80cc481096c.src.rpm

       -modify the SOURCES/kernel-olpc-custom.config to have
	      CONFIG_OPROFILE=y

       -build the olpc kernel package with:
	     rpmbuild -ba --define "dist olpc1p" --define "olpc 1" \
	     --define "head dc5079fafb767e4" --target=i586 \
	     /usr/src/redhat/SPECS/olpc-2.6.spec

       -copy the kernel i586 RPM package over to the OLPC machine
	    rpm -Uvh kernel-2.6.21-20070309.olpc1p.dc5079fafb767e4.i586.rpm

       -copy the vmlinux created from the RPM build,
	    BUILD/kernel-2.6.21/linux-2.6.21.i586/vmlinux,
	    to OLPC machine root

       -reboot machine with new kernel

       -install binutils via yum:
	       yum install binutils

       -install the oprofile rpm via yum:
	       yum install oprofile

       -configure oprofile with:
           opcontrol --setup --vmlinux=/root/vmlinux --separate=library

       -start oprofile with:
           opcontrol --start

       -do something to put load on machine

       -shutdown oprofile with:
           opcontrol --shutdown

       -look at the oprofile sample data with opreport:
           opreport -t 5


Example output from OLPC Beta 2 machine running "opreport -t 5":

CPU: CPU with timer interrupt, speed 0 MHz (estimated)
Profiling through timer interrupt
           TIMER:0|
   samples|      %|
------------------
    106605 73.8144 vmlinux-20070309.olpc1p.dc5079fafb767e4
     14767 10.2248 python
                   TIMER:0|
           samples|      %|
         ------------------
              3927 26.5931 libxul.so
              3208 21.7241 libpython2.4.so.1.0
              1742 11.7966 libc-2.5.so
               884  5.9863 libcairo.so.2.10.3
               731  4.9502 libgobject-2.0.so.0.1200.9
               631  4.2730 libglib-2.0.so.0.1200.9
               546  3.6974 libmozjs.so
               328  2.2212 libpthread-2.5.so
               273  1.8487 libgdk-x11-2.0.so.0.1000.8
               256  1.7336 ld-2.5.so
               217  1.4695 libabiword-2.5.so
               192  1.3002 libnspr4.so
               190  1.2867 libpangoft2-1.0.so.0.1500.1
               182  1.2325 libfontconfig.so.1.1.0
               171  1.1580 libgtk-x11-2.0.so.0.1000.8
               159  1.0767 libvte.so.9.1.7
               129  0.8736 libfreetype.so.6.3.10
               115  0.7788 libdbus-1.so.3.2.0
                96  0.6501 libX11.so.6.2.0
                91  0.6162 libpango-1.0.so.0.1500.1
                62  0.4199 libhippocanvas-1.so.0.0.0
                59  0.3995 libxml2.so.2.6.27
                58  0.3928 libgdk_pixbuf-2.0.so.0.1000.8
                58  0.3928 librsvg-2.so.2.16.1
                56  0.3792 libXft.so.2.1.2
                56  0.3792 libXrender.so.1.3.0
                32  0.2167 libexpat.so.0.5.0
                28  0.1896 libgthread-2.0.so.0.1200.9
                28  0.1896 libstdc++.so.6.0.8
                25  0.1693 _gobject.so
                22  0.1490 pyexpat.so
                21  0.1422 libm-2.5.so
                13  0.0880 libpangocairo-1.0.so.0.1500.1
                11  0.0745 libgstreamer-0.10.so.0.9.0
                11  0.0745 _gtk.so
                10  0.0677 libjpeg.so.62.0.0
                10  0.0677 libz.so.1.2.3
                10  0.0677 _dbus_bindings.so
                 9  0.0609 anon (tgid:1770 range:0xb7f1b000-0xb7f1c000)
                 9  0.0609 libplds4.so
                 7  0.0474 anon (tgid:1775 range:0xb7fcc000-0xb7fcd000)
                 7  0.0474 anon (tgid:1800 range:0xb7f17000-0xb7f18000)
                 7  0.0474 libfreebl3.so
                 6  0.0406 libolpc.so
                 6  0.0406 libpangoxft-1.0.so.0.1500.1
                 6  0.0406 libwnck-1.so.18.2.6
                 6  0.0406 pango-basic-fc.so
                 5  0.0339 anon (tgid:1747 range:0xb7f21000-0xb7f22000)
                 5  0.0339 anon (tgid:1948 range:0xb7f43000-0xb7f44000)
                 5  0.0339 libdbus-glib-1.so.2.0.0
                 5  0.0339 libplc4.so
                 5  0.0339 _cairo.so
                 5  0.0339 hippo.so
                 4  0.0271 libresolv-2.5.so
                 4  0.0271 libXcursor.so.1.0.2
                 3  0.0203 anon (tgid:1752 range:0xb7fa4000-0xb7fa5000)
                 3  0.0203 anon (tgid:3334 range:0xb7fc8000-0xb7fc9000)
                 3  0.0203 libcrypto.so.0.9.8b
                 3  0.0203 libsoftokn3.so
                 2  0.0135 anon (tgid:3320 range:0xb7f91000-0xb7f92000)
                 2  0.0135 libasound.so.2.0.0
                 2  0.0135 libnss3.so
                 1  0.0068 anon (tgid:3330 range:0xb7f44000-0xb7f45000)
                 1  0.0068 anon (tgid:3346 range:0xb7f12000-0xb7f13000)
                 1  0.0068 libdl-2.5.so
                 1  0.0068 libnss_files-2.5.so
                 1  0.0068 UTF-16.so
                 1  0.0068 libXfixes.so.3.1.0
                 1  0.0068 libssl3.so
                 1  0.0068 md5module.so
                 1  0.0068 _sugar.so
                 1  0.0068 rsvg.so
     14155  9.8011 Xorg
                   TIMER:0|
           samples|      %|
         ------------------
             10769 76.0791 libfb.so
              1521 10.7453 Xorg
              1100  7.7711 libexa.so
               401  2.8329 libc-2.5.so
               241  1.7026 libshadow.so
                74  0.5228 amd_drv.so
                18  0.1272 evdev_drv.so
                17  0.1201 libextmod.so
                 9  0.0636 anon (tgid:1742 range:0xb7f56000-0xb7f57000)
                 1  0.0071 anon (tgid:1747 range:0xb7fb4000-0xb7fb5000)
                 1  0.0071 anon (tgid:3315 range:0xb7f31000-0xb7f32000)
                 1  0.0071 ld-2.5.so
                 1  0.0071 libz.so.1.2.3
                 1  0.0071 libramdac.so


OProfile definitely works on the OLPC machine, but there is room for
improvement.

Oprofile Timer mode will work with minimal changes to the kernel RPM
and this could provide some overall view where the processor is
spending time.  There are some performance monitoring counters on the
Geode processor, but they do not generate the NMI interrupt expected
by the oprofile x86 driver. In many cases just showing samples where
the processor is spending time would help focus effort to eliminate
hotspots.

Oprofile's implementation of timer base sampling may not be ideal on
the OLPC laptop. OProfile timer based mechanism expects a timer to
fire periodically to take a sample. With the move to tickless kernels
to save power having the timer fire off periodically will increase
power consumption. In the samples recorded for the vmlinux kernel in
the example above, most (94%) are for default idle function.

OProfile's requirment of a vmlinux file for profiling the kernel
causes more space to be needed. For Fedora these files are include in
the kernel-debuginfo RPM.  The debuginfo RPMs are very large and it is
not practical to install the 150MB kernel-debuginfo RPM on the
machine.  The vmlinux file alone takes about 30MB uncompressed, quite
a bit of space when compared to the 512MB image for the system.

The oparchive allows samples to be packaged. However, this command was
designed for machines where space was not an issue. It copies the
sample files and the matching binaries into a another directory. For
the example above the directory took 102MB of which 1.7MB was sample
data.  It would probably be better to send over the samples to the
machine doing the analysis. There should be an existing image of the
OLPC file system available on the machine doing the analysis.

Doing analysis on x86_64 machine of the OLPC i386 data is a bit
awkward due to needing to use opimport on the data files due to the
different field sizes in sample files.


-Will



More information about the Devel mailing list