Add basic tracing lib files
This commit is contained in:
parent
7c51d23850
commit
5583fa68d1
4 changed files with 67 additions and 0 deletions
30
tracetools/include/tracetools/tracetools.h
Normal file
30
tracetools/include/tracetools/tracetools.h
Normal file
|
@ -0,0 +1,30 @@
|
|||
#ifndef __TRACETOOLS_TRACETOOLS_H_
|
||||
#define __TRACETOOLS_TRACETOOLS_H_
|
||||
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#define TRACEPOINT(event_name, ...) \
|
||||
(ros_trace_##event_name)(__VA_ARGS__)
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Report whether tracing is compiled in
|
||||
*/
|
||||
bool ros_trace_compile_status();
|
||||
|
||||
/**
|
||||
* tp: rcl_init
|
||||
*/
|
||||
void ros_trace_rcl_init();
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __TRACETOOLS_TRACETOOLS_H_ */
|
3
tracetools/src/.gitignore
vendored
Normal file
3
tracetools/src/.gitignore
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
# generated files (LTTng)
|
||||
tp_call.c
|
||||
tp_call.h
|
14
tracetools/src/status.c
Normal file
14
tracetools/src/status.c
Normal file
|
@ -0,0 +1,14 @@
|
|||
#include <stdio.h>
|
||||
#include "tracetools/tracetools.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
printf("Tracing ");
|
||||
if (ros_trace_compile_status()) {
|
||||
printf("enabled\n");
|
||||
return 0;
|
||||
} else {
|
||||
printf("disabled\n");
|
||||
return 1;
|
||||
}
|
||||
}
|
20
tracetools/src/tracetools.c
Normal file
20
tracetools/src/tracetools.c
Normal file
|
@ -0,0 +1,20 @@
|
|||
#include "tracetools/tracetools.h"
|
||||
|
||||
#ifdef WITH_LTTNG
|
||||
#include "tp_call.h"
|
||||
#endif
|
||||
|
||||
|
||||
bool ros_trace_compile_status() {
|
||||
#ifdef WITH_LTTNG
|
||||
return true;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
void ros_trace_rcl_init() {
|
||||
#ifdef WITH_LTTNG
|
||||
tracepoint(ros2, rcl_init);
|
||||
#endif
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue