1use std::mem::size_of;
2
3
4#[derive(Clone, Debug, Default)]
6pub struct TracepointOpts {
7 pub cookie: u64,
9 #[doc(hidden)]
10 pub _non_exhaustive: (),
11}
12
13impl From<TracepointOpts> for libbpf_sys::bpf_tracepoint_opts {
14 fn from(opts: TracepointOpts) -> Self {
15 let TracepointOpts {
16 cookie,
17 _non_exhaustive,
18 } = opts;
19
20 #[allow(clippy::needless_update)]
21 libbpf_sys::bpf_tracepoint_opts {
22 sz: size_of::<Self>() as _,
23 bpf_cookie: cookie,
24 ..Default::default()
26 }
27 }
28}
29
30#[derive(Clone, Debug, Default)]
32pub struct RawTracepointOpts {
33 pub cookie: u64,
35 #[doc(hidden)]
36 pub _non_exhaustive: (),
37}
38
39impl From<RawTracepointOpts> for libbpf_sys::bpf_raw_tracepoint_opts {
40 fn from(opts: RawTracepointOpts) -> Self {
41 let RawTracepointOpts {
42 cookie,
43 _non_exhaustive,
44 } = opts;
45
46 #[allow(clippy::needless_update)]
47 libbpf_sys::bpf_raw_tracepoint_opts {
48 sz: size_of::<Self>() as _,
49 cookie,
50 ..Default::default()
52 }
53 }
54}
55
56
57#[non_exhaustive]
62#[derive(Debug, Clone)]
63pub enum TracepointCategory {
64 P9,
66 Afs,
68 Alarmtimer,
70 Asoc,
72 Avc,
74 Bcache,
76 Block,
78 BpfTestRun,
80 BpfTrace,
82 Bridge,
84 Btrfs,
86 Cachefiles,
88 Cgroup,
90 Clk,
92 Cma,
94 Compaction,
96 ContextTracking,
98 Cpuhp,
100 Csd,
102 Damon,
104 Devfreq,
106 Devlink,
108 Dlm,
110 Dma,
112 DmaFence,
114 Erofs,
116 ErrorReport,
118 Ext4,
120 F2Fs,
122 Fib,
124 Fib6,
126 Filelock,
128 Filemap,
130 Fscache,
132 FsDax,
134 Fsi,
136 FsiMasterAspeed,
138 FsiMasterAstCf,
140 FsiMasterGpio,
142 FsiMasterI2Cr,
144 Gpio,
146 GpuMem,
148 Habanalabs,
150 Handshake,
152 Host1X,
154 HugeMemory,
156 Hugetlbfs,
158 Hwmon,
160 HwPressure,
162 I2C,
164 I2CSlave,
166 IbMad,
168 IbUmad,
170 Icmp,
172 Initcall,
174 IntelIfs,
176 IntelIsh,
178 IntelSst,
180 Iocost,
182 Iommu,
184 IoUring,
186 Ipi,
188 Irq,
190 IrqMatrix,
192 Iscsi,
194 Jbd2,
196 Kmem,
198 Ksm,
200 Kvm,
202 Kyber,
204 Libata,
206 Lock,
208 MapleTree,
210 Mce,
212 Mctp,
214 Mdio,
216 Memcg,
218 Migrate,
220 Mlxsw,
222 Mmap,
224 MmapLock,
226 Mmc,
228 Module,
230 Mptcp,
232 Napi,
234 Nbd,
236 Neigh,
238 Net,
240 Netfs,
242 Netlink,
244 Nilfs2,
246 Nmi,
248 Notifier,
250 Objagg,
252 Oom,
254 Osnoise,
256 PageIsolation,
258 Pagemap,
260 PagePool,
262 PageRef,
264 Percpu,
266 Power,
268 Preemptirq,
270 Printk,
272 Pwc,
274 Pwm,
276 Qdisc,
278 Qla,
280 Qrtr,
282 RawSyscalls,
284 Rcu,
286 RdmaCore,
288 Regulator,
290 Rpcgss,
292 Rpcrdma,
294 Rpm,
296 Rseq,
298 Rtc,
300 RustSample,
302 Rv,
304 Rwmmio,
306 Rxrpc,
308 Sched,
310 SchedExt,
312 Scmi,
314 Scsi,
316 Sctp,
318 Signal,
320 Siox,
322 Skb,
324 Smbus,
326 Sock,
328 Sof,
330 SofIntel,
332 Spi,
334 Spmi,
336 Sunrpc,
338 Sunvnet,
340 Swiotlb,
342 Syscalls,
344 Target,
346 Task,
348 Tcp,
350 TegraApbDma,
352 Thp,
354 Timer,
356 TimerMigration,
358 Timestamp,
360 Tlb,
362 Udp,
364 V4L2,
366 Vb2,
368 Vmalloc,
370 Vmscan,
372 Vsock,
374 Watchdog,
376 Wbt,
378 Workqueue,
380 Writeback,
382 Xdp,
384 Xen,
386 Custom(String),
388}
389
390impl AsRef<str> for TracepointCategory {
391 fn as_ref(&self) -> &str {
392 match self {
393 TracepointCategory::P9 => "9p",
394 TracepointCategory::Afs => "afs",
395 TracepointCategory::Alarmtimer => "alarmtimer",
396 TracepointCategory::Asoc => "asoc",
397 TracepointCategory::Avc => "avc",
398 TracepointCategory::Bcache => "bcache",
399 TracepointCategory::Block => "block",
400 TracepointCategory::BpfTestRun => "bpf_test_run",
401 TracepointCategory::BpfTrace => "bpf_trace",
402 TracepointCategory::Bridge => "bridge",
403 TracepointCategory::Btrfs => "btrfs",
404 TracepointCategory::Cachefiles => "cachefiles",
405 TracepointCategory::Cgroup => "cgroup",
406 TracepointCategory::Clk => "clk",
407 TracepointCategory::Cma => "cma",
408 TracepointCategory::Compaction => "compaction",
409 TracepointCategory::ContextTracking => "context_tracking",
410 TracepointCategory::Cpuhp => "cpuhp",
411 TracepointCategory::Csd => "csd",
412 TracepointCategory::Damon => "damon",
413 TracepointCategory::Devfreq => "devfreq",
414 TracepointCategory::Devlink => "devlink",
415 TracepointCategory::Dlm => "dlm",
416 TracepointCategory::Dma => "dma",
417 TracepointCategory::DmaFence => "dma_fence",
418 TracepointCategory::Erofs => "erofs",
419 TracepointCategory::ErrorReport => "error_report",
420 TracepointCategory::Ext4 => "ext4",
421 TracepointCategory::F2Fs => "f2fs",
422 TracepointCategory::Fib => "fib",
423 TracepointCategory::Fib6 => "fib6",
424 TracepointCategory::Filelock => "filelock",
425 TracepointCategory::Filemap => "filemap",
426 TracepointCategory::Fscache => "fscache",
427 TracepointCategory::FsDax => "fs_dax",
428 TracepointCategory::Fsi => "fsi",
429 TracepointCategory::FsiMasterAspeed => "fsi_master_aspeed",
430 TracepointCategory::FsiMasterAstCf => "fsi_master_ast_cf",
431 TracepointCategory::FsiMasterGpio => "fsi_master_gpio",
432 TracepointCategory::FsiMasterI2Cr => "fsi_master_i2cr",
433 TracepointCategory::Gpio => "gpio",
434 TracepointCategory::GpuMem => "gpu_mem",
435 TracepointCategory::Habanalabs => "habanalabs",
436 TracepointCategory::Handshake => "handshake",
437 TracepointCategory::Host1X => "host1x",
438 TracepointCategory::HugeMemory => "huge_memory",
439 TracepointCategory::Hugetlbfs => "hugetlbfs",
440 TracepointCategory::Hwmon => "hwmon",
441 TracepointCategory::HwPressure => "hw_pressure",
442 TracepointCategory::I2C => "i2c",
443 TracepointCategory::I2CSlave => "i2c_slave",
444 TracepointCategory::IbMad => "ib_mad",
445 TracepointCategory::IbUmad => "ib_umad",
446 TracepointCategory::Icmp => "icmp",
447 TracepointCategory::Initcall => "initcall",
448 TracepointCategory::IntelIfs => "intel_ifs",
449 TracepointCategory::IntelIsh => "intel_ish",
450 TracepointCategory::IntelSst => "intel-sst",
451 TracepointCategory::Iocost => "iocost",
452 TracepointCategory::Iommu => "iommu",
453 TracepointCategory::IoUring => "io_uring",
454 TracepointCategory::Ipi => "ipi",
455 TracepointCategory::Irq => "irq",
456 TracepointCategory::IrqMatrix => "irq_matrix",
457 TracepointCategory::Iscsi => "iscsi",
458 TracepointCategory::Jbd2 => "jbd2",
459 TracepointCategory::Kmem => "kmem",
460 TracepointCategory::Ksm => "ksm",
461 TracepointCategory::Kvm => "kvm",
462 TracepointCategory::Kyber => "kyber",
463 TracepointCategory::Libata => "libata",
464 TracepointCategory::Lock => "lock",
465 TracepointCategory::MapleTree => "maple_tree",
466 TracepointCategory::Mce => "mce",
467 TracepointCategory::Mctp => "mctp",
468 TracepointCategory::Mdio => "mdio",
469 TracepointCategory::Memcg => "memcg",
470 TracepointCategory::Migrate => "migrate",
471 TracepointCategory::Mlxsw => "mlxsw",
472 TracepointCategory::Mmap => "mmap",
473 TracepointCategory::MmapLock => "mmap_lock",
474 TracepointCategory::Mmc => "mmc",
475 TracepointCategory::Module => "module",
476 TracepointCategory::Mptcp => "mptcp",
477 TracepointCategory::Napi => "napi",
478 TracepointCategory::Nbd => "nbd",
479 TracepointCategory::Neigh => "neigh",
480 TracepointCategory::Net => "net",
481 TracepointCategory::Netfs => "netfs",
482 TracepointCategory::Netlink => "netlink",
483 TracepointCategory::Nilfs2 => "nilfs2",
484 TracepointCategory::Nmi => "nmi",
485 TracepointCategory::Notifier => "notifier",
486 TracepointCategory::Objagg => "objagg",
487 TracepointCategory::Oom => "oom",
488 TracepointCategory::Osnoise => "osnoise",
489 TracepointCategory::PageIsolation => "page_isolation",
490 TracepointCategory::Pagemap => "pagemap",
491 TracepointCategory::PagePool => "page_pool",
492 TracepointCategory::PageRef => "page_ref",
493 TracepointCategory::Percpu => "percpu",
494 TracepointCategory::Power => "power",
495 TracepointCategory::Preemptirq => "preemptirq",
496 TracepointCategory::Printk => "printk",
497 TracepointCategory::Pwc => "pwc",
498 TracepointCategory::Pwm => "pwm",
499 TracepointCategory::Qdisc => "qdisc",
500 TracepointCategory::Qla => "qla",
501 TracepointCategory::Qrtr => "qrtr",
502 TracepointCategory::RawSyscalls => "raw_syscalls",
503 TracepointCategory::Rcu => "rcu",
504 TracepointCategory::RdmaCore => "rdma_core",
505 TracepointCategory::Regulator => "regulator",
506 TracepointCategory::Rpcgss => "rpcgss",
507 TracepointCategory::Rpcrdma => "rpcrdma",
508 TracepointCategory::Rpm => "rpm",
509 TracepointCategory::Rseq => "rseq",
510 TracepointCategory::Rtc => "rtc",
511 TracepointCategory::RustSample => "rust_sample",
512 TracepointCategory::Rv => "rv",
513 TracepointCategory::Rwmmio => "rwmmio",
514 TracepointCategory::Rxrpc => "rxrpc",
515 TracepointCategory::Sched => "sched",
516 TracepointCategory::SchedExt => "sched_ext",
517 TracepointCategory::Scmi => "scmi",
518 TracepointCategory::Scsi => "scsi",
519 TracepointCategory::Sctp => "sctp",
520 TracepointCategory::Signal => "signal",
521 TracepointCategory::Siox => "siox",
522 TracepointCategory::Skb => "skb",
523 TracepointCategory::Smbus => "smbus",
524 TracepointCategory::Sock => "sock",
525 TracepointCategory::Sof => "sof",
526 TracepointCategory::SofIntel => "sof_intel",
527 TracepointCategory::Spi => "spi",
528 TracepointCategory::Spmi => "spmi",
529 TracepointCategory::Sunrpc => "sunrpc",
530 TracepointCategory::Sunvnet => "sunvnet",
531 TracepointCategory::Swiotlb => "swiotlb",
532 TracepointCategory::Syscalls => "syscalls",
533 TracepointCategory::Target => "target",
534 TracepointCategory::Task => "task",
535 TracepointCategory::Tcp => "tcp",
536 TracepointCategory::TegraApbDma => "tegra_apb_dma",
537 TracepointCategory::Thp => "thp",
538 TracepointCategory::Timer => "timer",
539 TracepointCategory::TimerMigration => "timer_migration",
540 TracepointCategory::Timestamp => "timestamp",
541 TracepointCategory::Tlb => "tlb",
542 TracepointCategory::Udp => "udp",
543 TracepointCategory::V4L2 => "v4l2",
544 TracepointCategory::Vb2 => "vb2",
545 TracepointCategory::Vmalloc => "vmalloc",
546 TracepointCategory::Vmscan => "vmscan",
547 TracepointCategory::Vsock => "vsock",
548 TracepointCategory::Watchdog => "watchdog",
549 TracepointCategory::Wbt => "wbt",
550 TracepointCategory::Workqueue => "workqueue",
551 TracepointCategory::Writeback => "writeback",
552 TracepointCategory::Xdp => "xdp",
553 TracepointCategory::Xen => "xen",
554 TracepointCategory::Custom(category) => category,
555 }
556 }
557}