test_tracepoint.c 596 B

1234567891011121314151617181920212223242526
  1. // SPDX-License-Identifier: GPL-2.0
  2. // Copyright (c) 2017 Facebook
  3. #include <linux/bpf.h>
  4. #include "bpf_helpers.h"
  5. /* taken from /sys/kernel/debug/tracing/events/sched/sched_switch/format */
  6. struct sched_switch_args {
  7. unsigned long long pad;
  8. char prev_comm[16];
  9. int prev_pid;
  10. int prev_prio;
  11. long long prev_state;
  12. char next_comm[16];
  13. int next_pid;
  14. int next_prio;
  15. };
  16. SEC("tracepoint/sched/sched_switch")
  17. int oncpu(struct sched_switch_args *ctx)
  18. {
  19. return 0;
  20. }
  21. char _license[] SEC("license") = "GPL";
  22. __u32 _version SEC("version") = 1; /* ignored by tracepoints, required by libbpf.a */