dongle26
dongle26

Reputation: 856

Profiling a C program under CentOS Linux

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?

Upvotes: 0

Views: 1248

Answers (1)

dongle26
dongle26

Reputation: 856

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.

Upvotes: 1

Related Questions