]> CyberLeo.Net >> Repos - FreeBSD/stable/10.git/blob - cddl/contrib/dtracetoolkit/Proc/pidpersec.d
Copy head (r256279) to stable/10 as part of the 10.0-RELEASE cycle.
[FreeBSD/stable/10.git] / cddl / contrib / dtracetoolkit / Proc / pidpersec.d
1 #!/usr/sbin/dtrace -s
2 /*
3  * pidpersec.d - print new PIDs per sec.
4  *               Written using DTrace (Solaris 10 3/05)
5  *
6  * This script prints the number of new processes created per second.
7  *
8  * $Id: pidpersec.d 3 2007-08-01 10:50:08Z brendan $
9  *
10  * USAGE: pidpersec.d
11  *
12  * FIELDS:
13  *
14  *          TIME        Time, as a string
15  *          LASTPID     Last PID created
16  *          PID/s       Number of processes created per second
17  *
18  * SEE ALSO: execsnoop
19  *
20  * COPYRIGHT: Copyright (c) 2005 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  * 09-Jun-2005  Brendan Gregg   Created this.
37  * 09-Jun-2005     "      "     Last update.
38  */
39
40 #pragma D option quiet
41
42 dtrace:::BEGIN
43 {
44         printf("%-22s %8s %6s\n", "TIME", "LASTPID", "PID/s");
45         pids = 0;
46 }
47
48 proc:::exec-success
49 {
50         pids++;
51 }
52
53 profile:::tick-1sec
54 {
55         printf("%-22Y %8d %6d\n", walltimestamp, `mpid, pids);
56         pids = 0;
57 }