From 3a5c55ab40314cec95feed222c29589f9cf6ff70 Mon Sep 17 00:00:00 2001 From: Erik Boasson Date: Thu, 5 Oct 2023 17:47:43 +0200 Subject: [PATCH] Export dds_write_impl dds_write_impl is a convenient trace point for instrumenting the code for performance measurements. Signed-off-by: Erik Boasson --- cmake/Modules/GenerateExportHeader.cmake | 13 +++++++++++++ src/core/ddsc/src/dds__write.h | 3 +++ src/core/xtests/symbol_export/symbol_export.c | 5 +++++ 3 files changed, 21 insertions(+) diff --git a/cmake/Modules/GenerateExportHeader.cmake b/cmake/Modules/GenerateExportHeader.cmake index 17182b175c..52057af006 100644 --- a/cmake/Modules/GenerateExportHeader.cmake +++ b/cmake/Modules/GenerateExportHeader.cmake @@ -63,6 +63,19 @@ if(_include_file) # define ${_prefix_name}${_base_name_upper}_INLINE_EXPORT ${_prefix_name}${_base_name_upper}_EXPORT # endif #endif + +// Some internal functions are exported even though are not part of the API nor +// foreseen to ever be called by a user of the library (unlike some functions +// that are exported for convenience in building tools or even examples, such as +// the AVL tree). One reason for this is that they are useful in instrumenting +// Cyclone DDS with some performance analysis tools, and it is in the interest +// of the projec that such analyses can be done. +// +// There is no guarantee that such internal symbols will remain available or +// that their role will be the same. +#ifndef ${_prefix_name}${_base_name_upper}_EXPORT_INTERNAL_FUNCTION +# define ${_prefix_name}${_base_name_upper}_EXPORT_INTERNAL_FUNCTION ${_prefix_name}${_base_name_upper}_EXPORT +#endif ") if(_GEHW_CUSTOM_CONTENT_FROM_VARIABLE) diff --git a/src/core/ddsc/src/dds__write.h b/src/core/ddsc/src/dds__write.h index 620bc3e75c..429fc7e66e 100644 --- a/src/core/ddsc/src/dds__write.h +++ b/src/core/ddsc/src/dds__write.h @@ -11,6 +11,8 @@ #ifndef DDS__WRITE_H #define DDS__WRITE_H +#include "dds/export.h" + #if defined (__cplusplus) extern "C" { #endif @@ -29,6 +31,7 @@ typedef enum { } dds_write_action; /** @component write_data */ +DDS_EXPORT_INTERNAL_FUNCTION dds_return_t dds_write_impl (dds_writer *wr, const void *data, dds_time_t tstamp, dds_write_action action); /** @component write_data */ diff --git a/src/core/xtests/symbol_export/symbol_export.c b/src/core/xtests/symbol_export/symbol_export.c index d05e329e82..1a70c8c00c 100644 --- a/src/core/xtests/symbol_export/symbol_export.c +++ b/src/core/xtests/symbol_export/symbol_export.c @@ -71,6 +71,8 @@ #include "dds/cdr/dds_cdrstream.h" +#include "dds__write.h" // dds_write_impl + DDSRT_WARNING_DEPRECATED_OFF #ifdef DDS_HAS_SECURITY @@ -1051,6 +1053,9 @@ int main (int argc, char **argv) test_ddsrt_vasprintf (ptr, " "); ddsrt_asprintf (ptr, " "); + // dds__write.h + dds_write_impl (ptr, ptr, 0, (dds_write_action) 0); + return 0; }