# the source files include the tracing headers like
# #include "tracing/oprequest.h". so better put them into
# ${PROJECT_BINARY_DIR}/include, where acconfig.h is also located
-set(header_dir ${CMAKE_BINARY_DIR}/include/tracing)
+set(working_dir ${CMAKE_BINARY_DIR}/include)
+set(header_dir ${working_dir}/tracing)
file(MAKE_DIRECTORY ${header_dir})
file(GLOB tps "*.tp")
foreach(tp ${tps})
get_filename_component(name ${tp} NAME_WE)
set(header ${header_dir}/${name}.h)
- set(src ${header_dir}/${name}.c)
add_custom_command(
- OUTPUT ${header} ${src}
- COMMAND ${LTTNG_GEN_TP} ${tp} -o tracing/${name}.h -o tracing/${name}.c
+ OUTPUT ${header}
+ COMMAND ${LTTNG_GEN_TP} ${tp} -o tracing/${name}.h
DEPENDS ${tp}
- WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/include
- COMMENT "generating ${header} ${src}")
- set_source_files_properties(${header} ${src}
- PROPERTIES GENERATED TRUE)
+ WORKING_DIRECTORY ${working_dir}
+ COMMENT "generating ${header}")
add_custom_target(
${name}-tp
DEPENDS ${header})
get_filename_component(tp ${tp_file} NAME_WE)
list(APPEND hdrs
${header_dir}/${tp}.h)
- list(APPEND srcs
- ${header_dir}/${tp}.h
- ${header_dir}/${tp}.c)
endforeach()
- add_library(${name} SHARED ${srcs})
+ add_library(${name} SHARED ${hdrs} ${tp}.c)
target_link_libraries(${name} ${LTTNGUST_LIBRARIES} ${CMAKE_DL_LIBS})
string(REGEX MATCH "^[0-9]+" soversion ${version})
set_target_properties(${name} PROPERTIES
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`). Place the `.tp` file into the `src/tracing` directory
+`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](http://lttng.org/docs/#doc-dynamic-linking) for details.
+Place the `.tp` and the `.c` files into the `src/tracing` directory
and modify the CMake file `src/tracing/CMakeLists.txt` accordingly.
+
+