]> CyberLeo.Net >> Repos - FreeBSD/stable/10.git/blob - cddl/contrib/dtracetoolkit/Proc/sysbypid.d
Copy head (r256279) to stable/10 as part of the 10.0-RELEASE cycle.
[FreeBSD/stable/10.git] / cddl / contrib / dtracetoolkit / Proc / sysbypid.d
1 #!/usr/sbin/dtrace -s
2 /*
3  * sysbypid.d - print sysinfo events by process.
4  *              Uses DTrace (Solaris 10 3/05).
5  *
6  * $Id: sysbypid.d 3 2007-08-01 10:50:08Z brendan $
7  *
8  * USAGE: sysbypid.d
9  *
10  * FIELDS:
11  *              EXEC    Process name
12  *              PID     Process ID
13  *              SYS     System statistic (see /usr/include/sys/sysinfo.h)
14  *              VALUE   Value by which statistic was incremented
15  *
16  * The virtual memory statistics are documented in the cpu_sysinfo struct
17  * in the /usr/include/sys/sysinfo.h file; and also in the sysinfo provider
18  * chapter of the DTrace Guide, http://docs.sun.com/db/doc/817-6223.
19  *
20  * COPYRIGHT: Copyright (c) 2005, 2006 Brendan Gregg.
21  *
22  * CDDL HEADER START
23  *
24  *  The contents of this file are subject to the terms of the
25  *  Common Development and Distribution License, Version 1.0 only
26  *  (the "License").  You may not use this file except in compliance
27  *  with the License.
28  *
29  *  You can obtain a copy of the license at Docs/cddl1.txt
30  *  or http://www.opensolaris.org/os/licensing.
31  *  See the License for the specific language governing permissions
32  *  and limitations under the License.
33  *
34  * CDDL HEADER END
35  *
36  * 14-May-2005  Brendan Gregg   Created this.
37  * 20-Apr-2006     "      "     Last update.
38  */
39
40 #pragma D option quiet
41
42 dtrace:::BEGIN {
43         printf("Tracing... Hit Ctrl-C to end.\n");
44 }
45
46 sysinfo::: {
47         @Sys[execname, pid, probename] = sum(arg0);
48 }
49
50 dtrace:::END {
51         printf("%16s %8s %22s %8s\n", "EXEC", "PID", "SYS", "VALUE");
52         printa("%16s %8d %22s %@8d\n", @Sys);
53 }