ceph/src/tracing
Mohamad Gebai 021dcf7bfb tracing: add documentation for function instrumentation
Signed-off-by: Mohamad Gebai <mgebai@suse.com>
2017-05-25 15:16:21 -04:00
..
.gitignore
CMakeLists.txt tracing: add cyg_profile tracepoint provider 2017-05-25 15:16:21 -04:00
cyg_profile_functions.c tracing: add -finstrument-functions for OSD 2017-05-25 15:16:21 -04:00
cyg_profile.c tracing: add cyg_profile tracepoint provider 2017-05-25 15:16:21 -04:00
cyg_profile.tp tracing: add cyg_profile tracepoint provider 2017-05-25 15:16:21 -04:00
eventtrace.c common: extend lttng tracing infrastructure 2017-01-16 13:58:57 -08:00
eventtrace.tp common: extend lttng tracing infrastructure 2017-01-16 13:58:57 -08:00
librados.c lttng: build the tracepoint provider lib from .c files in repo 2016-09-22 21:24:02 +08:00
librados.tp librados: add cmpext API 2017-04-26 09:10:28 +08:00
librbd.c lttng: build the tracepoint provider lib from .c files in repo 2016-09-22 21:24:02 +08:00
librbd.tp librbd: extended parent info API to retrieve parent id 2017-05-01 10:10:13 -04:00
objectstore.c lttng: build the tracepoint provider lib from .c files in repo 2016-09-22 21:24:02 +08:00
objectstore.tp tracing/objectstore.tp: add missing move_ranges_... tp 2016-10-13 16:57:58 -04:00
oprequest.c lttng: build the tracepoint provider lib from .c files in repo 2016-09-22 21:24:02 +08:00
oprequest.tp
osd.c lttng: build the tracepoint provider lib from .c files in repo 2016-09-22 21:24:02 +08:00
osd.tp ceph osd: add support for new op cmpext 2017-04-26 09:08:22 +08:00
pg.c lttng: build the tracepoint provider lib from .c files in repo 2016-09-22 21:24:02 +08:00
pg.tp
README.md tracing: add documentation for function instrumentation 2017-05-25 15:16:21 -04:00
tracing-common.h

Installation

The LTTng libraries that ship with Ubuntu 12.04 have been very buggy, and the generated header files using lttng-gen-tp have needed to be fixed just to compile in the Ceph tree. The packages available in Ubuntu 14.04 seem to work alright, and for older versions please install LTTng from the LTTng PPA.

https://launchpad.net/~lttng/+archive/ppa

Then install as normal

apt-get install lttng-tools liblttng-ust-dev

Add/Update Provider

Create tracepoint definition file

Add tracepoint definitions for the provider into a .tp file. Documentation on defining a tracepoint can be found in man lttng-ust. By convention files are named according to the logical sub-system they correspond to (e.g. mutex.tp, pg.tp). And add a C source file to be compiled into the tracepoint provider shared object, in which TRACEPOINT_DEFINE should be defined. See LTTng document for details. Place the .tp and the .c files into the src/tracing directory and modify the CMake file src/tracing/CMakeLists.txt accordingly.

Function Instrumentation

Ceph supports instrumentation using GCC's -finstrument-functions flag. Supported CMake flags are:

  • -DWITH_OSD_INSTRUMENT_FUNCTIONS=ON: instrument OSD code

Note that this instrumentation adds an extra function call on each function entry and exit of Ceph code. This option is currently only supported with GCC. Using it with Clang has no effect.

The only function tracing implementation at the moment is done using LTTng UST. In order to use it, Ceph needs to be configured with LTTng using -DWITH_LTTNG=ON. TraceCompass can be used to generate flame charts/graphs and other metrics.

It is also possible to use libbabeltrace to write custom analysis. The entry and exit tracepoints are called lttng_ust_cyg_profile:func_enter and lttng_ust_cyg_profile:func_exit respectively. The payload variable addr holds the address of the function called and the payload variable call_site holds the address where it is called. nm can be used to resolve function addresses (addr to function name).