]> CyberLeo.Net >> Repos - FreeBSD/stable/10.git/blob - cddl/contrib/dtracetoolkit/Proc/syscallbypid.d
Copy head (r256279) to stable/10 as part of the 10.0-RELEASE cycle.
[FreeBSD/stable/10.git] / cddl / contrib / dtracetoolkit / Proc / syscallbypid.d
1 #!/usr/sbin/dtrace -s
2 /*
3  * syscallbypid.d - report on syscalls by PID.
4  *                  Written using DTrace (Solaris 10 3/05)
5  *
6  * $Id: syscallbypid.d 3 2007-08-01 10:50:08Z brendan $
7  *
8  * USAGE:       syscallbypid.d                  # hit Ctrl-C to end sample
9  *
10  * FIELDS:
11  *              PID             process ID
12  *              CMD             process name
13  *              SYSCALL         syscall name
14  *              COUNT           number of syscalls for this PID
15  *
16  * This is based on a script from DExplorer.
17  *
18  * COPYRIGHT: Copyright (c) 2005, 2006 Brendan Gregg.
19  *
20  * CDDL HEADER START
21  *
22  *  The contents of this file are subject to the terms of the
23  *  Common Development and Distribution License, Version 1.0 only
24  *  (the "License").  You may not use this file except in compliance
25  *  with the License.
26  *
27  *  You can obtain a copy of the license at Docs/cddl1.txt
28  *  or http://www.opensolaris.org/os/licensing.
29  *  See the License for the specific language governing permissions
30  *  and limitations under the License.
31  *
32  * CDDL HEADER END
33  *
34  * 15-May-2005  Brendan Gregg   Created this.
35  * 20-Apr-2006     "      "     Last update.
36  */
37
38 #pragma D option quiet
39
40 dtrace:::BEGIN
41 {
42         printf("Tracing... Hit Ctrl-C to end.\n");
43 }
44
45 syscall:::entry
46 {
47         @num[pid, execname, probefunc] = count();
48 }
49
50 dtrace:::END
51 {
52         printf("%6s %-24s %-24s %8s\n", "PID", "CMD", "SYSCALL", "COUNT");
53         printa("%6d %-24s %-24s %@8d\n", @num);
54 }