3
# Uses alias suffixes to track time intervals for a subset of kernel
4
# functions. Based on func_time_stats.stp.
6
global start, intervals
8
# We can apply a suffix to multiple probe points designated by one alias:
9
probe miscellany = syscall.open, syscall.close, syscall.read, syscall.write { }
12
start[name, tid()] = gettimeofday_us()
15
# The 'return' suffix is passed on to each of the underlying probe points:
16
probe miscellany.return {
17
t = gettimeofday_us(); old_t = start[name, tid()]
18
if (old_t) intervals[name] <<< t - old_t
19
delete start[name, tid()]
23
printf("Collecting data... press Ctrl-C to stop.\n")
27
foreach (name in intervals) {
28
printf("intervals for %s -- min:%dus avg:%dus max:%dus count:%d\n",
29
name, @min(intervals[name]), @avg(intervals[name]),
30
@max(intervals[name]), @count(intervals[name]))
31
print(@hist_log(intervals[name]))