Serene Runtime 1.0.0-dev
C runtime for the Serene programming language
Loading...
Searching...
No Matches
trace.h File Reference

Platform neutral static tracepoints. More...

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define SRN_TP_CONSUME(...)
#define SRN_TRACEPOINT(name, ...)
 Placement matters.
#define SRN_TRACEPOINT_WITH_GROUP(group, name, ...)

Detailed Description

Platform neutral static tracepoints.

SRN_TP(group, name, args...) is a probe a tracer observes only when attached. It maps to the native facility per platform and falls back to a no-op that still marks its arguments used on platforms with no facility, such as WebAssembly. Call sites never name a platform; this header owns that choice.

Definition in file trace.h.

Macro Definition Documentation

◆ SRN_TP_CONSUME

#define SRN_TP_CONSUME ( ...)

Definition at line 31 of file trace.h.

◆ SRN_TRACEPOINT

#define SRN_TRACEPOINT ( name,
... )
Value:
SRN_TP_CONSUME(__VA_ARGS__)
#define SRN_TP_CONSUME(...)
Definition trace.h:31

Placement matters.

SRN_TRACEPOINT expands to a probe instruction the compiler may leave right at a function's epilogue. Never put it as the last statement before a fiber's return. A fiber entry returns into the context switch trampoline, and a tracer breakpoint sitting on that teardown trips the stack protector and aborts the process under perf. Put it on an ordinary reachable statement with real code after it, and never right after a loop that never exits, where the optimizer deletes the probe. To mark a fiber's own start and end, emit from the scheduler around the switch rather than from inside the fiber.

Definition at line 79 of file trace.h.

◆ SRN_TRACEPOINT_WITH_GROUP

#define SRN_TRACEPOINT_WITH_GROUP ( group,
name,
... )
Value:
SRN_TP_CONSUME(__VA_ARGS__)

Definition at line 80 of file trace.h.