Skip to content
Snippets Groups Projects
  • Avi Kivity's avatar
    0102df29
    trace: add unique ID for tracepoints · 0102df29
    Avi Kivity authored
    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<trace_sched_queue_name, thread*> trace_sched_queue(...);
    
    but that doubles the code for declaring a tracepoint.  Add a unique ID instead
    (and code to verify it is unique).
    0102df29
    History
    trace: add unique ID for tracepoints
    Avi Kivity authored
    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<trace_sched_queue_name, thread*> trace_sched_queue(...);
    
    but that doubles the code for declaring a tracepoint.  Add a unique ID instead
    (and code to verify it is unique).