Debian Codegraph @

testsuite/systemtap.examples/lwtools/syscallbypid-nd.stp

raw
1 #!/usr/bin/stap
2 /*
3 * syscallbypid-nd.d Count syscalls with process details.
4 * For Linux, uses SystemTap (non-debuginfo).
5 *
6 * USAGE: ./syscallbypid-nd.d
7 *
8 * Copyright (C) 2015 Brendan Gregg.
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * 23-Jun-2014 Brendan Gregg Created this.
21 */
22
23 global num;
24
25 probe begin
26 {
27 printf("Tracing syscall completions... Hit Ctrl-C to end.\n");
28 }
29
30 probe syscall_any.return
31 {
32 num[pid(), execname(), name] <<< 1;
33 }
34
35 probe end
36 {
37 printf("\n%-8s %-16s %-24s %8s\n", "PID", "CMD", "SYSCALL", "COUNT");
38 foreach ([p, e, n] in num+) {
39 printf("%-8d %-16s %-24s %8d\n", p, e, n, @count(num[p, e, n]));
40 }
41 }