-
Notifications
You must be signed in to change notification settings - Fork 357
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add read/write instrumentation with LTTng
Signed-off-by: Christophe Bedard <bedard.christophe@gmail.com>
- Loading branch information
1 parent
f879dc0
commit d1073ae
Showing
9 changed files
with
177 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
/* | ||
* Copyright(c) 2021 Christophe Bedard | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Eclipse Public License v. 2.0 which is available at | ||
* http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License | ||
* v. 1.0 which is available at | ||
* http://www.eclipse.org/org/documents/edl-v10.php. | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause | ||
*/ | ||
|
||
#define TRACEPOINT_CREATE_PROBES | ||
|
||
#define TRACEPOINT_DEFINE | ||
#include "tracing_lttng.h" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
/* | ||
* Copyright(c) 2021 Christophe Bedard | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Eclipse Public License v. 2.0 which is available at | ||
* http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License | ||
* v. 1.0 which is available at | ||
* http://www.eclipse.org/org/documents/edl-v10.php. | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause | ||
*/ | ||
|
||
// Provide fake header guard for cpplint | ||
#undef _DDS_LTTNG_H_ | ||
#ifndef _DDS_LTTNG_H_ | ||
#define _DDS_LTTNG_H_ | ||
|
||
#include "dds/features.h" | ||
|
||
#undef TRACEPOINT_PROVIDER | ||
#define TRACEPOINT_PROVIDER dds | ||
|
||
#ifdef DDS_HAS_LTTNG_TRACING | ||
# define TRACEPOINT(event_name, ...) \ | ||
tracepoint(TRACEPOINT_PROVIDER, event_name, __VA_ARGS__) | ||
#else | ||
# define TRACEPOINT(event_name, ...) ((void) (0)) | ||
#endif // DDS_HAS_LTTNG_TRACING | ||
|
||
#undef TRACEPOINT_INCLUDE | ||
#define TRACEPOINT_INCLUDE "tracing_lttng.h" | ||
|
||
#if !defined(__DDS_LTTNG_H_) || defined(TRACEPOINT_HEADER_MULTI_READ) | ||
#define __DDS_LTTNG_H_ | ||
|
||
#include <lttng/tracepoint.h> | ||
|
||
#if defined(DDS_HAS_LTTNG_TRACING) && !defined(LTTNG_UST_HAVE_SDT_INTEGRATION) | ||
# ifdef _MSC_VER | ||
# pragma message ("lttng-ust has not been configured & built with SDT integration (--with-sdt)") | ||
# else | ||
# warning lttng-ust has not been configured & built with SDT integration (--with-sdt) | ||
# endif | ||
#endif | ||
|
||
#include <stdint.h> | ||
#include <stdbool.h> | ||
|
||
#define DDS_GID_STORAGE_SIZE 16u | ||
|
||
TRACEPOINT_EVENT( | ||
TRACEPOINT_PROVIDER, | ||
create_writer, | ||
TP_ARGS( | ||
const void *, writer_arg, | ||
char *, topic_name_arg, | ||
const uint8_t *, gid_arg | ||
), | ||
TP_FIELDS( | ||
ctf_integer_hex(const void *, writer, writer_arg) | ||
ctf_string(topic_name, topic_name_arg) | ||
ctf_array(uint8_t, gid, gid_arg, DDS_GID_STORAGE_SIZE) | ||
) | ||
) | ||
|
||
TRACEPOINT_EVENT( | ||
TRACEPOINT_PROVIDER, | ||
create_reader, | ||
TP_ARGS( | ||
const void *, reader_arg, | ||
char *, topic_name_arg, | ||
const uint8_t *, gid_arg | ||
), | ||
TP_FIELDS( | ||
ctf_integer_hex(const void *, reader, reader_arg) | ||
ctf_string(topic_name, topic_name_arg) | ||
ctf_array(uint8_t, gid, gid_arg, DDS_GID_STORAGE_SIZE) | ||
) | ||
) | ||
|
||
TRACEPOINT_EVENT( | ||
TRACEPOINT_PROVIDER, | ||
write, | ||
TP_ARGS( | ||
const void *, writer_arg, | ||
const void *, data_arg, | ||
int64_t, timestamp_arg | ||
), | ||
TP_FIELDS( | ||
ctf_integer_hex(const void *, writer, writer_arg) | ||
ctf_integer_hex(const void *, data, data_arg) | ||
ctf_integer(int64_t, timestamp, timestamp_arg) | ||
) | ||
) | ||
|
||
TRACEPOINT_EVENT( | ||
TRACEPOINT_PROVIDER, | ||
read, | ||
TP_ARGS( | ||
const void *, reader_arg, | ||
const void *, buffer_arg | ||
), | ||
TP_FIELDS( | ||
ctf_integer_hex(const void *, reader, reader_arg) | ||
ctf_integer_hex(const void *, buffer, buffer_arg) | ||
) | ||
) | ||
|
||
#endif // __DDS_LTTNG_H_ | ||
|
||
#include <lttng/tracepoint-event.h> | ||
|
||
#endif // _DDS_LTTNG_H_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters