Permalink
Find file
Fetching contributors…
Cannot retrieve contributors at this time
34 lines (28 sloc) 626 Bytes
#!/usr/bin/env ktap
#
# syslatl.kp syscall latency linear aggregation
#
# 10-Nov-2013 Brendan Gregg Created this
var step = 10 # number of ms per step
var self = {}
var lats = {}
var max = 0
trace syscalls:sys_enter_* {
self[tid] = gettimeofday_us()
}
trace syscalls:sys_exit_* {
if (self[tid] == nil) { return }
var delta = (gettimeofday_us() - self[tid]) / (step * 1000)
if (delta > max) { max = delta }
lats[delta] += 1
self[tid] = nil
}
trace_end {
printf(" %8s %8s\n", "LAT(ms)+", "COUNT");
for (i = 0, max, 1) {
if (lats[i] == nil) {
lats[i] = 0
}
printf(" %8d %8d\n", i * step, lats[i]);
}
}