Performance statistics tool for programs (truss/ktrace/strace/nbench)

I'm looking for some diagnostic tool, which could be combination of debuggers like truss, ktrace, strace, benchmarking tools nbench, statistic tools like top, iotop (from Linux) and FreeBSD shortcut Control-T.
Basically I need to run the binary and check the statistics, as much information as possible, how much time was spend on interrupts, user, system, how many file request. Basically on what the program spend most of the time.
Is there any tool like that?
 
Have a look at % systat -vmstat.
But that's a more overall picture.

You're probably looking for a profiler. Have a look at gprof(1).
 
Installed /usr/ports/lang/php52 with -pg flags.
Code:
cc -pipe -pg -march=nocona -pg -g -O0 -Wall ext/date/.libs/php_date.o ext/date/...
...
> gprof `which php`
gprof: /usr/local/bin/php.gmon: No such file or directory
Why it doesn't work? How to generate gmon file? I want to run profiler for php binary it-self.
 
Ok, I figure it out:
Code:
sudo sl
gprof `which sl` sl.gmon | head
Code:
  %   cumulative   self              self     total           
 time   seconds   seconds    calls  ms/call  ms/call  name    
 53.6       0.01     0.01        0  100.00%           _mcount [1]
 25.0       0.02     0.01        0  100.00%           _select [2]
 10.7       0.03     0.00    17372     0.00     0.00  __vfprintf [5]
...
  0.0       0.03     0.00      253     0.00     0.00  add_smoke [20]
:)

First you need to run it, and then use gprof against generated gmon file.
Many thanks!
 
Back
Top