Skip to content

Add TRACEPOINT_ENABLED() and DO_TRACEPOINT() macros#46

Merged
christophebedard merged 1 commit intorollingfrom
christophebedard/add-tracepoint-enabled-and-do-tracepoint-macros
Feb 22, 2023
Merged

Add TRACEPOINT_ENABLED() and DO_TRACEPOINT() macros#46
christophebedard merged 1 commit intorollingfrom
christophebedard/add-tracepoint-enabled-and-do-tracepoint-macros

Conversation

@christophebedard
Copy link
Copy Markdown
Member

This adds the TRACEPOINT_ENABLED() and DO_TRACEPOINT() macros alongside the current TRACEPOINT() macro. These tracetools macros correspond to LTTng's tracepoint_enabled(), do_tracepoint(), and tracepoint() macros, respectively. See lttng-ust(3).

During runtime, this allows first checking if the tracepoint is enabled before doing some processing and triggering the tracepoint manually. This way, we avoid doing unnecessary processing/memory allocations/etc. if the tracepoint isn't enabled.

Eventually, for tracers that do not support this mechanism, we can just #define TRACEPOINT_ENABLED(...) true and #define DO_TRACEPOINT(...) TRACEPOINT(__VA_ARGS__).

Signed-off-by: Christophe Bedard christophe.bedard@apex.ai

Signed-off-by: Christophe Bedard <christophe.bedard@apex.ai>
@christophebedard
Copy link
Copy Markdown
Member Author

cc @iluetkeb

Copy link
Copy Markdown
Member

@mjcarroll mjcarroll left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is a reasonable path forward as it allows the most flexibility.

@christophebedard
Copy link
Copy Markdown
Member Author

christophebedard commented Feb 21, 2023

Testing --packages-above tracetools:

  • Linux Build Status
  • Linux-aarch64 Build Status
  • Windows Build Status

@christophebedard
Copy link
Copy Markdown
Member Author

Alright, CI looks good.

@christophebedard christophebedard merged commit 8096196 into rolling Feb 22, 2023
@christophebedard christophebedard deleted the christophebedard/add-tracepoint-enabled-and-do-tracepoint-macros branch February 22, 2023 18:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants