Skip to content

Commit

Permalink
tracing: automake-ify tracepoint generation
Browse files Browse the repository at this point in the history
Signed-off-by: Noah Watkins <[email protected]>
  • Loading branch information
dotnwat authored and liewegas committed Aug 21, 2014
1 parent 915a6a6 commit 33b87f9
Show file tree
Hide file tree
Showing 14 changed files with 46 additions and 221 deletions.
7 changes: 7 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -802,6 +802,13 @@ AC_CHECK_TYPES([__u8, __s8, __u16, __s16, __u32, __s32, __u64, __s64, __le16,
AC_CHECK_HEADER([lttng/tracepoint.h], [],
AC_MSG_ERROR([lttng/tracepoint.h not found (liblttng-ust-dev)]))

AC_CHECK_PROG([LTTNG_GEN_TP_CHECK], [lttng-gen-tp], [yes])
if test x"$LTTNG_GEN_TP_CHECK" != "xyes"; then
AC_MSG_FAILURE([lttng-gen-tp not found])
fi
AC_SUBST([LTTNG_GEN_TP_PROG], [lttng-gen-tp])


# Checks for typedefs, structures, and compiler characteristics.
#AC_HEADER_STDBOOL
#AC_C_CONST
Expand Down
2 changes: 1 addition & 1 deletion src/common/Mutex.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#include "common/config.h"
#include "include/utime.h"
#include "common/Clock.h"
#include "tracing/mutex.tp.h"
#include "tracing/mutex.h"

Mutex::Mutex(const char *n, bool r, bool ld,
bool bt,
Expand Down
2 changes: 1 addition & 1 deletion src/osd/OSD.cc
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@

#include "include/assert.h"
#include "common/config.h"
#include "tracing/osd.tp.h"
#include "tracing/osd.h"

#define dout_subsys ceph_subsys_osd
#undef dout_prefix
Expand Down
2 changes: 1 addition & 1 deletion src/osd/PG.cc
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
#include "messages/MOSDSubOp.h"
#include "messages/MOSDSubOpReply.h"
#include "common/BackTrace.h"
#include "tracing/pg.tp.h"
#include "tracing/pg.h"

#include <sstream>

Expand Down
2 changes: 1 addition & 1 deletion src/osd/ReplicatedPG.cc
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
#include "json_spirit/json_spirit_value.h"
#include "json_spirit/json_spirit_reader.h"
#include "include/assert.h" // json_spirit clobbers it
#include "tracing/osd.tp.h"
#include "tracing/osd.h"

#define dout_subsys ceph_subsys_osd
#define DOUT_PREFIX_ARGS this, osd->whoami, get_osdmap()
Expand Down
2 changes: 2 additions & 0 deletions src/tracing/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*.h
*.c
22 changes: 16 additions & 6 deletions src/tracing/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,12 +1,22 @@
%.c %.h: %.tp
$(LTTNG_GEN_TP_PROG) $<
rm -f $<.o

dist_noinst_DATA = mutex.tp osd.tp pg.tp

libtracepoints_la_SOURCES = \
mutex.tp.c \
mutex.tp.h \
osd.tp.c \
osd.tp.h \
pg.tp.h \
pg.tp.c
mutex.c \
mutex.h \
osd.c \
osd.h \
pg.h \
pg.c

libtracepoints_la_LIBADD = -llttng-ust -ldl
libtracepoints_la_CPPFLAGS = -DTRACEPOINT_PROBE_DYNAMIC_LINKAGE
libtracepoints_la_LDFLAGS =
noinst_LTLIBRARIES = libtracepoints.la

BUILT_SOURCES = mutex.h osd.h pg.h

CLEANFILES = $(libtracepoints_la_SOURCES)
42 changes: 17 additions & 25 deletions src/tracing/README.md
Original file line number Diff line number Diff line change
@@ -1,32 +1,24 @@
Add New 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`).
Installation
============

## Generate tracepoint source files
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.

The `.tp` file is converted into source files using the `lttng-gen-tp` tool.
https://launchpad.net/~lttng/+archive/ppa

lttng-gen-tp mutex.tp -o mutex.tp.h -o mutex.tp.c
Then install as normal

## Add source files to libtracepoints.la
apt-get install lttng-tools liblttng-ust-dev

Modify Makefile.am to include the generated source files from the previous
step.

## Commit changes to Git

Commit both the source `.tp` file as well as the generated sources, and the
changes to Makefile.am.
Add/Update Provider
================

Add Tracepoint to Existing Provider
===================================
## Create tracepoint definition file

New tracepoints can be added to an existing provider by updating the
corresponding `.tp` file and re-generating the source files. Make sure to
commit the updated files back into Git.
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`). Place the `.tp` file into the `src/tracing` directory
and modify the automake file `src/tracing/Makefile.am` accordingly.
7 changes: 0 additions & 7 deletions src/tracing/mutex.tp.c

This file was deleted.

45 changes: 0 additions & 45 deletions src/tracing/mutex.tp.h

This file was deleted.

7 changes: 0 additions & 7 deletions src/tracing/osd.tp.c

This file was deleted.

90 changes: 0 additions & 90 deletions src/tracing/osd.tp.h

This file was deleted.

7 changes: 0 additions & 7 deletions src/tracing/pg.tp.c

This file was deleted.

30 changes: 0 additions & 30 deletions src/tracing/pg.tp.h

This file was deleted.

0 comments on commit 33b87f9

Please sign in to comment.