xref: /spdk/scripts/bpf/intr-wakeups.bt (revision a1dfa7ec92a6c49538482c8bb73f0b1ce040441f)
1/*
2 * Trace reasons for SPDK to wake up in interrupt mode.
3 *
4 * You'll probably need bpftrace from https://github.com/fbs/el7-bpf-specs
5 *
6 * Usage:
7 * scripts/bpftrace.sh `pidof spdk_tgt` [all]
8 *     all: show every event, not just the first after waking up
9 */
10
11tracepoint:sched:sched_switch /comm == "reactor_0"/
12{
13	if (str($1) == "all") {
14		printf("%llums: %s is off-cpu\n", elapsed / 1000000, comm);
15	}
16	@off = 1;
17}
18
19/*
20 * We explicitly filter out the framework-level handlers here in favour of the
21 * more specific tracepoints below.
22 */
23usdt:__EXE__:spdk:interrupt_fd_process /
24	@off == 1 &&
25	strncmp(str(arg1), "event_queue_run_batch", 40) != 0 &&
26	strncmp(str(arg1), "interrupt_timerfd_process", 40) != 0 &&
27	strncmp(str(arg1), "thread_interrupt_msg_process", 40) != 0 &&
28	strncmp(str(arg1), "thread_process_interrupts", 40) != 0
29/
30{
31	printf("%llums:%s: fd:%d %s(%p)\n", elapsed / 1000000, probe, arg2, usym(arg3), arg4);
32	if (str($1) != "all") {
33	    @off = 0;
34	}
35}
36
37usdt:__EXE__:spdk:timerfd_exec /@off == 1/
38{
39	printf("%llums:%s: %s(%p)\n", elapsed / 1000000, probe, usym(arg1), arg2);
40	if (str($1) != "all") {
41	    @off = 0;
42	}
43}
44
45usdt:__EXE__:spdk:msg_exec /@off == 1/
46{
47	printf("%llums:%s: %s(%p)\n", elapsed / 1000000, probe, usym(arg1), arg2);
48	if (str($1) != "all") {
49	    @off = 0;
50	}
51}
52
53usdt:__EXE__:spdk:event_exec /@off == 1/
54{
55	printf("%llums:%s: %s(%p, %p)\n", elapsed / 1000000, probe, usym(arg1),
56           arg2, arg3);
57	if (str($1) != "all") {
58	    @off = 0;
59	}
60}
61