Under CentOS what commandline will profile my C program including the time spent in system calls? What programs do I need to install with yum?
Asked
Active
Viewed 1,228 times
0
-
2You can use [oprofile](http://linux.die.net/man/1/oprofile). – Paul R Oct 11 '12 at 20:19
-
Or you can use [perf](https://perf.wiki.kernel.org/index.php/Tutorial) (`yum install perf` in CentOS6) – osgx Oct 11 '12 at 20:57
-
I have a solution for your regex to C question. See my answer at http://stackoverflow.com/questions/12505210/convert-compile-regular-expressions-to-c-code – Oct 19 '12 at 07:45
1 Answers
1
Install oprofile: yum install oprofile
Initialize oprofile:
opcontrol --no-vmlinux #If you have vmlinux set this option differently
opcontrol --init
opcontrol --reset
opcontrol --separate=lib
opcontrol --callgraph=0 # clear callgraph in case it was used recently
opcontrol --start
Now run the program to be profiled. Once it has run long enough, do the following:
opcontrol --dump
opreport --symbols /path/to/executable
See here for some other example outputs.

dongle26
- 826
- 1
- 10
- 18