| 1 |
#! /usr/bin/env stap |
| 2 |
|
| 3 |
# Copyright (C) 2006 IBM Corp. |
| 4 |
# |
| 5 |
# This file is part of systemtap, and is free software. You can |
| 6 |
# redistribute it and/or modify it under the terms of the GNU General |
| 7 |
# Public License (GPL); either version 2, or (at your option) any |
| 8 |
# later version. |
| 9 |
|
| 10 |
# |
| 11 |
# Print the system call count by process ID in descending order. |
| 12 |
# |
| 13 |
|
| 14 |
global syscalls |
| 15 |
|
| 16 |
probe begin { |
| 17 |
print ("Collecting data... Type Ctrl-C to exit and display results\n") |
| 18 |
} |
| 19 |
|
| 20 |
probe syscall_any { |
| 21 |
syscalls[pid()] <<< 1 |
| 22 |
} |
| 23 |
|
| 24 |
probe end { |
| 25 |
printf ("%-10s %-s\n", "#SysCalls", "PID") |
| 26 |
foreach (pid in syscalls-) |
| 27 |
printf("%-10d %-d\n", @sum(syscalls[pid]), pid) |
| 28 |
} |