7

Shark on Mac OS X is a great tool for profiling an application on a running system. Is there any similar tools for Linux?

OProfile looks like it could be, anyone used it?

opyate
  • 5,388
  • 1
  • 37
  • 64
epatel
  • 45,805
  • 17
  • 110
  • 144

4 Answers4

9

Extending another answer, I use the 'callgrind' option of valgrind (http://valgrind.org). Then install kcachegrind from KDE for a nice GUI interface.

As a dummy's tutorial, do:

1) Compile your application with debugging information. It's a good idea to try profiling with optimization both on and off, with optimization off you will get more information, but it may be less accurate (in particular tiny functions will seem to take up more time than they deserve.

2) Run with:

valgrind --tool=callgrind <name of your app> <your app's options>

This should produce a file called 'callgrind.something', which you can load into kcachegrind.

You can also look at:

valgrind --tool=cachegrind <name of your app> <your app's options>

Which will give you information about how your app is interacting with your CPU's cache.

Note that while valgrind and shark seem like similar apps, they work very differently. When you run an app in valgrind it will run many times slower than normal (often over 40 times slower), but the results you get are much more accurate than shark's. I tend to use both, so I can get as much information as possible!

orestisf
  • 1,396
  • 1
  • 15
  • 30
Chris Jefferson
  • 7,225
  • 11
  • 43
  • 66
5

You can probably try Valgrind (http://valgrind.org/). They have both runtime and compile time profiling tools.

5

A bit late to answer this one, but the closest answer is Zoom. Some of the Shark team worked on it.

ohmantics
  • 1,799
  • 14
  • 16
  • Update: also note that Zoom now runs on Mac OS X...and Shark is gone completely. – federal Oct 22 '12 at 18:57
  • Sadly Zoom is no longer maintained. From the RotateRight website: "Zoom has not been updated since 2015, so it may not work on newer systems. There are no plans to continue development on Zoom at this time." – chadrik Aug 10 '18 at 22:40
4

OProfile is a tool that does sampling-based profiling of both your application and the system calls it makes. This allows for seeing detailed information about where it's spending time. It doesn't have a GUI, but there are several front-ends that will let you process the information from the runs.

I've used it extensively, both for desktop applications and for embedded systems. It takes a little effort to interpret the results, but the callgraph output is really useful here.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Ben Combee
  • 16,831
  • 6
  • 41
  • 42