Use tracepoint definition files directly
This commit is contained in:
parent
4cfd83809a
commit
f728cd467b
5 changed files with 52 additions and 29 deletions
5
tracetools/.gitignore
vendored
5
tracetools/.gitignore
vendored
|
@ -1,5 +0,0 @@
|
||||||
traces/
|
|
||||||
|
|
||||||
# generated files (LTTng)
|
|
||||||
tp_call.c
|
|
||||||
tp_call.h
|
|
|
@ -19,15 +19,8 @@ if(WITH_LTTNG)
|
||||||
pkg_check_modules(LTTNG REQUIRED lttng-ust)
|
pkg_check_modules(LTTNG REQUIRED lttng-ust)
|
||||||
endif()
|
endif()
|
||||||
if(LTTNG_FOUND)
|
if(LTTNG_FOUND)
|
||||||
# Generate necessary LTTng files
|
set(LTTNG_TP_FILES
|
||||||
# If successful, enable tracing
|
include/tracetools/tp_call.h
|
||||||
add_custom_command(OUTPUT ${PROJECT_SOURCE_DIR}/src/tp_call.c ${PROJECT_SOURCE_DIR}/include/tp_call.h
|
|
||||||
COMMAND lttng-gen-tp tp_call.tp -o tp_call.c -o ../include/tp_call.h
|
|
||||||
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/src
|
|
||||||
DEPENDS ${PROJECT_SOURCE_DIR}/src/tp_call.tp
|
|
||||||
)
|
|
||||||
set(LTTNG_GENERATED
|
|
||||||
include/tp_call.h
|
|
||||||
src/tp_call.c
|
src/tp_call.c
|
||||||
)
|
)
|
||||||
set(TRACING_ENABLED TRUE)
|
set(TRACING_ENABLED TRUE)
|
||||||
|
@ -61,7 +54,7 @@ set(SOURCES
|
||||||
src/utils.cpp
|
src/utils.cpp
|
||||||
)
|
)
|
||||||
if(TRACING_ENABLED)
|
if(TRACING_ENABLED)
|
||||||
list(APPEND SOURCES ${LTTNG_GENERATED})
|
list(APPEND SOURCES ${LTTNG_TP_FILES})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_library(${PROJECT_NAME} ${SOURCES})
|
add_library(${PROJECT_NAME} ${SOURCES})
|
||||||
|
|
|
@ -12,10 +12,21 @@
|
||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
|
#undef TRACEPOINT_PROVIDER
|
||||||
|
#define TRACEPOINT_PROVIDER ros2
|
||||||
|
|
||||||
|
#undef TRACEPOINT_INCLUDE
|
||||||
|
#define TRACEPOINT_INCLUDE "tracetools/tp_call.h"
|
||||||
|
|
||||||
|
#if !defined(___INCLUDE_TP_CALL_H) || defined(TRACEPOINT_HEADER_MULTI_READ)
|
||||||
|
#define ___INCLUDE_TP_CALL_H
|
||||||
|
|
||||||
|
#include <lttng/tracepoint.h>
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
TRACEPOINT_EVENT(
|
TRACEPOINT_EVENT(
|
||||||
ros2,
|
TRACEPOINT_PROVIDER,
|
||||||
rcl_init,
|
rcl_init,
|
||||||
TP_ARGS(
|
TP_ARGS(
|
||||||
const void *, context_handle_arg,
|
const void *, context_handle_arg,
|
||||||
|
@ -28,7 +39,7 @@ TRACEPOINT_EVENT(
|
||||||
)
|
)
|
||||||
|
|
||||||
TRACEPOINT_EVENT(
|
TRACEPOINT_EVENT(
|
||||||
ros2,
|
TRACEPOINT_PROVIDER,
|
||||||
rcl_node_init,
|
rcl_node_init,
|
||||||
TP_ARGS(
|
TP_ARGS(
|
||||||
const void *, node_handle_arg,
|
const void *, node_handle_arg,
|
||||||
|
@ -45,7 +56,7 @@ TRACEPOINT_EVENT(
|
||||||
)
|
)
|
||||||
|
|
||||||
TRACEPOINT_EVENT(
|
TRACEPOINT_EVENT(
|
||||||
ros2,
|
TRACEPOINT_PROVIDER,
|
||||||
rcl_publisher_init,
|
rcl_publisher_init,
|
||||||
TP_ARGS(
|
TP_ARGS(
|
||||||
const void *, publisher_handle_arg,
|
const void *, publisher_handle_arg,
|
||||||
|
@ -64,7 +75,7 @@ TRACEPOINT_EVENT(
|
||||||
)
|
)
|
||||||
|
|
||||||
TRACEPOINT_EVENT(
|
TRACEPOINT_EVENT(
|
||||||
ros2,
|
TRACEPOINT_PROVIDER,
|
||||||
rcl_subscription_init,
|
rcl_subscription_init,
|
||||||
TP_ARGS(
|
TP_ARGS(
|
||||||
const void *, subscription_handle_arg,
|
const void *, subscription_handle_arg,
|
||||||
|
@ -83,7 +94,7 @@ TRACEPOINT_EVENT(
|
||||||
)
|
)
|
||||||
|
|
||||||
TRACEPOINT_EVENT(
|
TRACEPOINT_EVENT(
|
||||||
ros2,
|
TRACEPOINT_PROVIDER,
|
||||||
rclcpp_subscription_callback_added,
|
rclcpp_subscription_callback_added,
|
||||||
TP_ARGS(
|
TP_ARGS(
|
||||||
const void *, subscription_handle_arg,
|
const void *, subscription_handle_arg,
|
||||||
|
@ -96,7 +107,7 @@ TRACEPOINT_EVENT(
|
||||||
)
|
)
|
||||||
|
|
||||||
TRACEPOINT_EVENT(
|
TRACEPOINT_EVENT(
|
||||||
ros2,
|
TRACEPOINT_PROVIDER,
|
||||||
rcl_service_init,
|
rcl_service_init,
|
||||||
TP_ARGS(
|
TP_ARGS(
|
||||||
const void *, service_handle_arg,
|
const void *, service_handle_arg,
|
||||||
|
@ -113,7 +124,7 @@ TRACEPOINT_EVENT(
|
||||||
)
|
)
|
||||||
|
|
||||||
TRACEPOINT_EVENT(
|
TRACEPOINT_EVENT(
|
||||||
ros2,
|
TRACEPOINT_PROVIDER,
|
||||||
rclcpp_service_callback_added,
|
rclcpp_service_callback_added,
|
||||||
TP_ARGS(
|
TP_ARGS(
|
||||||
const void *, service_handle_arg,
|
const void *, service_handle_arg,
|
||||||
|
@ -126,7 +137,7 @@ TRACEPOINT_EVENT(
|
||||||
)
|
)
|
||||||
|
|
||||||
TRACEPOINT_EVENT(
|
TRACEPOINT_EVENT(
|
||||||
ros2,
|
TRACEPOINT_PROVIDER,
|
||||||
rcl_client_init,
|
rcl_client_init,
|
||||||
TP_ARGS(
|
TP_ARGS(
|
||||||
const void *, client_handle_arg,
|
const void *, client_handle_arg,
|
||||||
|
@ -143,7 +154,7 @@ TRACEPOINT_EVENT(
|
||||||
)
|
)
|
||||||
|
|
||||||
TRACEPOINT_EVENT(
|
TRACEPOINT_EVENT(
|
||||||
ros2,
|
TRACEPOINT_PROVIDER,
|
||||||
rcl_timer_init,
|
rcl_timer_init,
|
||||||
TP_ARGS(
|
TP_ARGS(
|
||||||
const void *, timer_handle_arg,
|
const void *, timer_handle_arg,
|
||||||
|
@ -156,7 +167,7 @@ TRACEPOINT_EVENT(
|
||||||
)
|
)
|
||||||
|
|
||||||
TRACEPOINT_EVENT(
|
TRACEPOINT_EVENT(
|
||||||
ros2,
|
TRACEPOINT_PROVIDER,
|
||||||
rclcpp_timer_callback_added,
|
rclcpp_timer_callback_added,
|
||||||
TP_ARGS(
|
TP_ARGS(
|
||||||
const void *, timer_handle_arg,
|
const void *, timer_handle_arg,
|
||||||
|
@ -169,7 +180,7 @@ TRACEPOINT_EVENT(
|
||||||
)
|
)
|
||||||
|
|
||||||
TRACEPOINT_EVENT(
|
TRACEPOINT_EVENT(
|
||||||
ros2,
|
TRACEPOINT_PROVIDER,
|
||||||
rclcpp_callback_register,
|
rclcpp_callback_register,
|
||||||
TP_ARGS(
|
TP_ARGS(
|
||||||
const void *, callback_arg,
|
const void *, callback_arg,
|
||||||
|
@ -182,7 +193,7 @@ TRACEPOINT_EVENT(
|
||||||
)
|
)
|
||||||
|
|
||||||
TRACEPOINT_EVENT(
|
TRACEPOINT_EVENT(
|
||||||
ros2,
|
TRACEPOINT_PROVIDER,
|
||||||
callback_start,
|
callback_start,
|
||||||
TP_ARGS(
|
TP_ARGS(
|
||||||
const void *, callback_arg,
|
const void *, callback_arg,
|
||||||
|
@ -195,7 +206,7 @@ TRACEPOINT_EVENT(
|
||||||
)
|
)
|
||||||
|
|
||||||
TRACEPOINT_EVENT(
|
TRACEPOINT_EVENT(
|
||||||
ros2,
|
TRACEPOINT_PROVIDER,
|
||||||
callback_end,
|
callback_end,
|
||||||
TP_ARGS(
|
TP_ARGS(
|
||||||
const void *, callback_arg
|
const void *, callback_arg
|
||||||
|
@ -204,3 +215,7 @@ TRACEPOINT_EVENT(
|
||||||
ctf_integer_hex(const void *, callback, callback_arg)
|
ctf_integer_hex(const void *, callback, callback_arg)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
#endif /* ___INCLUDE_TP_CALL_H */
|
||||||
|
|
||||||
|
#include <lttng/tracepoint-event.h>
|
20
tracetools/src/tp_call.c
Normal file
20
tracetools/src/tp_call.c
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
// Copyright 2019 Robert Bosch GmbH
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
|
||||||
|
#define TRACEPOINT_CREATE_PROBES
|
||||||
|
/*
|
||||||
|
* The header containing our TRACEPOINT_EVENTs.
|
||||||
|
*/
|
||||||
|
#define TRACEPOINT_DEFINE
|
||||||
|
#include "tracetools/tp_call.h"
|
|
@ -15,7 +15,7 @@
|
||||||
#include "tracetools/tracetools.h"
|
#include "tracetools/tracetools.h"
|
||||||
|
|
||||||
#if defined(WITH_LTTNG) && !defined(_WIN32)
|
#if defined(WITH_LTTNG) && !defined(_WIN32)
|
||||||
# include "tp_call.h"
|
# include "tracetools/tp_call.h"
|
||||||
# define CONDITIONAL_TP(...) \
|
# define CONDITIONAL_TP(...) \
|
||||||
tracepoint(__VA_ARGS__)
|
tracepoint(__VA_ARGS__)
|
||||||
#else
|
#else
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue