global starttime, timebycall probe begin { printf("Collecting data - type Ctrl-C to print output and exit... %d\n", get_32k()) } probe syscall.* { starttime[name, tid()] = get_32k() } probe syscall.*.return { # Skip if we have not seen this before if (!([name, tid()] in starttime)) next delta = get_32k() - starttime[name, tid()] # Totals timebycall[name, tid(), execname()] <<< delta delete starttime[name, tid()] } function print_header() { printf("%22s %16s:%-6s %10s %12s %12s %12s %12s\n", "System Call", "execname", "pid", "Count", "Total 32K", "Avg 32K", "Min 32K", "Max 32K") } probe end { printf("END TIME %d\n", get_32k()) printf("\nTimes for XXX:\n\n") print_header() foreach ([call, pidt+, exe] in timebycall) printf("%22s %16s:%-6d %10d %12d %12d %12d %12d\n", call, exe, pidt, @count(timebycall[call, pidt, exe]), @sum(timebycall[call, pidt, exe]), @avg(timebycall[call, pidt, exe]), @min(timebycall[call, pidt, exe]), @max(timebycall[call, pidt, exe])) delete timebycall }