In order to optimize the fast path of tracepoints, we need to patch the call sites to skip calling the slow path code completely. In turn, that requires that each call site be unique -- a separate function.
In the current implementations, tracepoints with the same signature map to the same type. It would have been great to use the name as a discriminant (tracepoint<"sched_queue", thread*> trace_sched_queue(...);), but C++ does not support string literals as template arguments.
We could do
const char* trace_sched_queue_name = "sched_queue"; tracepoint
but that doubles the code for declaring a tracepoint. Add a unique ID instead (and code to verify it is unique).
0102df2 trace: add unique ID for tracepoints
core/sched.cc | 10 +++++-----
core/trace.cc | 33 +++++++++++++++++++++++++++++++--
fs/vfs/main.cc | 10 +++++-----
include/osv/trace.hh | 28 ++++++++++++++--------------
tests/tst-tracepoint.cc | 6 +++---
5 files changed, 58 insertions(+), 29 deletions(-)
Upstream: github.com