Skip to content

Commit a0740ef

Browse files
committed
debug: add latency detector script
This systemtap script can detect sources of latency in a seastar program, caused by continuations running for too long. To detect tasks running for >30ms: /path/to/task-latency.stap /path/to/binary 30
1 parent aaeb17b commit a0740ef

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

debug/task-latency.stap

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/usr/bin/stap
2+
3+
# usage: task_latency.stap process_name latency_threshold_ms
4+
5+
global start_time
6+
7+
probe process(@1).mark("reactor_run_tasks_single_start") {
8+
start_time[tid()] = gettimeofday_us()
9+
}
10+
11+
probe process(@1).mark("reactor_run_tasks_single_end") {
12+
delete start_time[tid()]
13+
}
14+
15+
probe timer.profile {
16+
if ([tid()] in start_time) {
17+
now = gettimeofday_us()
18+
start = start_time[tid()]
19+
if ((now - start) > $2 * 1000) {
20+
printf("detected tasks running for >%sms\n", @2)
21+
print_usyms(ubacktrace())
22+
}
23+
}
24+
}

0 commit comments

Comments
 (0)