This is a read-only archive. Find the latest Linux articles, documentation, and answers at the new Linux.com!

Linux.com

Feature: System Administration

Profiling entire system activity with sysprof

By Ben Martin on May 30, 2008 (4:00:00 PM)

Share    Print    Comments   

Profiling an application lets you see what functions are taking up most of the CPU time so you can concentrate your optimization efforts on making the those pieces of code run faster. With sysprof, you can profile all the applications that are running on your machine, including a multithreaded or multiprocessed application or a complex server application that has multiple parts. sysprof collects information about how much time is spent in each library and function as the applications execute.

sysprof provides both a kernel module and a GTK+ graphical interface to allow you to perform your profiling. You can find packages of sysprof for Ubuntu, openSUSE 10.3, and Fedora. To get the most out of sysprof you should also install the debug information for all the applications you wish to profile. Without the debug information you will see only the name of a shared library in the profile information and not be able to tell what functions are taking up the lion's share of time spent in that library. Sysprof offers great flexibility by letting you install these debuginfo packages temporarily on a deployed system, then start profiling it to find out what makes the system slow.

Once the packages are installed, getting up and running is a two-step process. First, insert the kernel module with modprobe sysprof-module, then fire up the graphical interface by running sysprof and click the Start button in the toolbar. From that point on sysprof will monitor and profile everything that your machine does.

After you start sysprof capturing profile information, run the applications that you are interested in profiling and interact with them in the normal manner. After you have performed the tasks that you wish to profile, click the profile button in the toolbar. This will stop sysprof from monitoring your system and allow you to investigate the profile data that sysprof captured. You can also save and load profile data you have just captured. Profile information is saved in XML format, and I didn't see any reference to symbols which would have to be resolved at load time, so the XML file should be able to be saved on one machine and analysed on another.

The rest of the functionality of sysprof is about analysing the captured profile. The sysprof window is divided into three main sections: Functions, Callers, and Descendants lists. The Functions list is your starting point. By default you will see a list of the executed functions, starting with the one that took the largest total time to execute. Items in the Functions list include executable processes, shared libraries, and the kernel itself.

Clicking on a function will show it in the Descendants list on the right side of the window. If you click a process in the Functions list then the Callers list at the bottom left will show <spontaneous>. If you click on a function, say f, in the Functions or Descendants list, then every function that calls the f function will be shown in the Callers list.

I managed to get a kernel Oops after executing rmmod sysprof_module, so you might like to avoid using sysprof on a production setup. Although the Oops was reported to all consoles, the system could still be used and rebooted in an orderly manner. In subsequent testing of module removal and reinsertion I didn't get another Oops, but I did manage to get the system into a state where I could no longer use sysprof without first rebooting.

Sysprof could benefit from some simple enhancements. It would be nice if sysprof's user interface included back and forward buttons to allow you to explore around the profile and backtrack at will. Also, being able to perform a profile capture from the command line would enable easier profiling on servers that might not have the required X Window libraries installed to allow you to execute the graphical client remotely. A console client would also make automated captures an easier task. Unfortunately, sysprof is only compatible with the i386 and x86-64 architectures; it might prove useful on the ARM platform too.

Because sysprof is packaged for many distributions already and does not require you to recompile your applications, you can use it to look for performance bottlenecks quickly.

Ben Martin has been working on filesystems for more than 10 years. He completed his Ph.D. and now offers consulting services focused on libferris, filesystems, and search solutions.

Share    Print    Comments   

Comments

on Profiling entire system activity with sysprof

Note: Comments are owned by the poster. We are not responsible for their content.

apt://, not packages.ubuntu.com

Posted by: Anonymous [ip: 76.74.192.12] on May 30, 2008 11:38 PM
Please use the apt protocol, not packages.ubuntu.com links. They're a lot quicker and easier to deal with.

In this case a link for "apt:sysprof" would've done it.

#

Profiling entire system activity with sysprof

Posted by: Anonymous [ip: 88.252.40.9] on May 31, 2008 04:17 PM
They're a lot quicker and easier to deal with.

They're a lot quicker and easier to deal with.

#

Missing from article - where is sysprof-module

Posted by: Anonymous [ip: 208.111.220.176] on June 02, 2008 03:34 AM
# yum install sysprof
.
.
# which sysprof
/usr/bin/sysprof
.
.
# modprobe sysprof-module
FATAL: Module sysprof_module not found.
.
# find / -name sysprof*
/lib/modules/2.6.22.14-72.fc6/extra/sysprof
/lib/modules/2.6.22.14-72.fc6/extra/sysprof/sysprof-module.ko
/usr/bin/sysprof
/usr/share/doc/sysprof-1.0.8
/usr/share/sysprof
/usr/share/sysprof/sysprof.glade
/usr/share/sysprof/sysprof-icon.png
/usr/share/pixmaps/sysprof-icon.png
.
.
Hey, I'm no expert - any help would be welcome...




#

Re: Missing from article - where is sysprof-module

Posted by: Anonymous [ip: 213.164.7.22] on June 02, 2008 12:18 PM
Use a hyphen, not an underscore:
# modprobe sysprof-module

#

Profiling entire system activity with sysprof

Posted by: Anonymous [ip: 62.146.138.133] on June 02, 2008 10:21 AM
Hmm... the module seems to be installed, at least if you're using kernel "2.6.22.14-72.fc6" (you can check this with 'uname -r'). Did you try to invoke 'depmod' and then modprobe the module again? I did not try sysprof myself, so I can only guess what's wrong...

#

This story has been archived. Comments can no longer be posted.



 
Tableless layout Validate XHTML 1.0 Strict Validate CSS Powered by Xaraya