Skip to content

Conversation

@JackZhao166
Copy link
Contributor

This patch adds support for raw tracepoints in offwaketime tool to reduce overhead compared to kprobes. Raw tracepoints have lower overhead because they don't require function entry/exit instrumentation.

The implementation:

  • Adds RAW_TRACEPOINT_PROBE handlers for sched_switch and sched_wakeup
  • Creates kprobe wrapper functions for backward compatibility
  • Automatically selects raw tracepoints when supported, falls back to kprobes otherwise
  • Refactors oncpu() function to accept both prev and next task_struct parameters for raw tracepoint compatibility

This follows the same pattern used in other BCC tools like wakeuptime.py and runqlat.py.

This patch adds support for raw tracepoints in offwaketime tool to reduce
overhead compared to kprobes. Raw tracepoints have lower overhead because
they don't require function entry/exit instrumentation.

The implementation:
- Adds RAW_TRACEPOINT_PROBE handlers for sched_switch and sched_wakeup
- Creates kprobe wrapper functions for backward compatibility
- Automatically selects raw tracepoints when supported, falls back to
  kprobes otherwise
- Refactors oncpu() function to accept both prev and next task_struct
  parameters for raw tracepoint compatibility

This follows the same pattern used in other BCC tools like wakeuptime.py
and runqlat.py.

Signed-off-by: Jack Zhao <[email protected]>
Copy link
Collaborator

@chenhengqi chenhengqi left a comment

Choose a reason for hiding this comment

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

LGTM overall.

@chenhengqi chenhengqi merged commit 380ee01 into iovisor:master Nov 26, 2025
1 of 12 checks passed
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