• Profiling
Skip to end of metadata
Go to start of metadata

Tools

  • gprof
  • Valgrind/Callgrind
    • KCachegrind

Requirements

To profile the core, there's a privilegues problem, because being started as root, but then dropping those becoming icinga user will disallow creating valuable profiles.

running with gprof will tell the following

_mcleanup: gmon.out: Permission denied

Resultion: Set icinga_user to root (only for profiling!!!), or wait for a proper runtime param (https://dev.icinga.org/issues/2289), meanwhile comment the drop privilegues functions and remove that code parts.

drop_privileges

Valgrind

Using callgrind for profiling.

http://valgrind.org/docs/manual/cl-manual.html

http://www.slac.stanford.edu/BFROOT/www/Computing/Optimization/genprof.html

icinga-core/base # valgrind --tool=callgrind --dump-instr=yes --simulate-cache=yes --collect-jumps=yes ./icinga /etc/icinga/icinga.cfg

KCachegrind can be used to visualize callground (and other) profiling outputs.

gprof

http://www.network-theory.co.uk/docs/gccintro/gccintro_80.html

Compile Icinga with gprof flags (-pg), i.e. in base/Makefile.in

# Compiler flags for use with gprof
CFLAGS=-Wall -g -pg -O2 -I/usr/include  -DHAVE_CONFIG_H -DNSCORE

Afterwards, you'll run the newly compiled binary, generating profiling output in gmon.out

1. shell

$ cd base/
$ sudo ./icinga /etc/icinga/icinga.cfg
...

2. shell

kill `pidof icinga`

Then run gprof on the binary and the output.

$ gprof icinga | less

Memory Profiling

https://blog.netways.de/2012/07/12/memory-profiling-mit-massif/

  • No labels