| 1 |
#! /usr/bin/env stap |
| 2 |
# Simple probe to detect when a process is waiting for more socket send |
| 3 |
# buffer memory. Usually means the process is doing writes larger than the |
| 4 |
# socket send buffer size or there is a slow receiver at the other side. |
| 5 |
# Increasing the socket's send buffer size might help decrease application |
| 6 |
# latencies, but it might also make it worse, so buyer beware. |
| 7 |
# |
| 8 |
# Typical output: timestamp in microseconds: procname(pid) event |
| 9 |
# |
| 10 |
# 1218230114875167: python(17631) blocked on full send buffer |
| 11 |
# 1218230114876196: python(17631) recovered from full send buffer |
| 12 |
# 1218230114876271: python(17631) blocked on full send buffer |
| 13 |
# 1218230114876479: python(17631) recovered from full send buffer |
| 14 |
|
| 15 |
probe kernel.function("sk_stream_wait_memory") |
| 16 |
{ |
| 17 |
printf("%u: %s(%d) blocked on full send buffer\n", |
| 18 |
gettimeofday_us(), execname(), pid()) |
| 19 |
} |
| 20 |
|
| 21 |
probe kernel.function("sk_stream_wait_memory").return |
| 22 |
{ |
| 23 |
printf("%u: %s(%d) recovered from full send buffer\n", |
| 24 |
gettimeofday_us(), execname(), pid()) |
| 25 |
} |
| 26 |
|