Skip to content

Commit

Permalink
Add lifecycle node state transition instrumentation
Browse files Browse the repository at this point in the history
Signed-off-by: Christophe Bedard <bedard.christophe@gmail.com>
  • Loading branch information
christophebedard committed Sep 17, 2020
1 parent 8bcada7 commit d657a60
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
3 changes: 3 additions & 0 deletions rcl_lifecycle/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ find_package(rcl REQUIRED)
find_package(rcutils REQUIRED)
find_package(rmw REQUIRED)
find_package(rosidl_runtime_c REQUIRED)
find_package(tracetools REQUIRED)

# Default to C11
if(NOT CMAKE_C_STANDARD)
Expand Down Expand Up @@ -49,6 +50,7 @@ ament_target_dependencies(rcl_lifecycle
"rcl"
"rcutils"
"rosidl_runtime_c"
"tracetools"
)

rcl_set_symbol_visibility_hidden(${PROJECT_NAME} LANGUAGE "C")
Expand Down Expand Up @@ -129,6 +131,7 @@ ament_export_dependencies(lifecycle_msgs)
ament_export_dependencies(rcl)
ament_export_dependencies(rcutils)
ament_export_dependencies(rosidl_runtime_c)
ament_export_dependencies(tracetools)
ament_package()

install(
Expand Down
2 changes: 2 additions & 0 deletions rcl_lifecycle/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,14 @@
<build_depend>rcutils</build_depend>
<build_depend>rmw</build_depend>
<build_depend>rosidl_runtime_c</build_depend>
<build_depend>tracetools</build_depend>

<exec_depend>lifecycle_msgs</exec_depend>
<exec_depend>rcl</exec_depend>
<exec_depend>rcutils</exec_depend>
<exec_depend>rmw</exec_depend>
<exec_depend>rosidl_runtime_c</exec_depend>
<exec_depend>tracetools</exec_depend>

<test_depend>ament_cmake_gtest</test_depend>
<test_depend>ament_lint_common</test_depend>
Expand Down
10 changes: 10 additions & 0 deletions rcl_lifecycle/src/rcl_lifecycle.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ extern "C"
#include "rcutils/logging_macros.h"
#include "rcutils/macros.h"
#include "rcutils/strdup.h"
#include "tracetools/tracetools.h"

#include "rcl_lifecycle/default_state_machine.h"
#include "rcl_lifecycle/transition_map.h"
Expand Down Expand Up @@ -238,6 +239,10 @@ rcl_lifecycle_state_machine_init(
}
}

TRACEPOINT(
rcl_lifecycle_state_machine_init,
(const void *)node_handle,
(const void *)state_machine);
return RCL_RET_OK;
}

Expand Down Expand Up @@ -365,6 +370,11 @@ _trigger_transition(
}
}

TRACEPOINT(
rcl_lifecycle_transition,
(const void *)state_machine,
transition->start->label,
state_machine->current_state->label);
return RCL_RET_OK;
}

Expand Down

0 comments on commit d657a60

Please sign in to comment.