1*c29d5175Schristos #!/usr/sbin/dtrace -s 2*c29d5175Schristos /* 3*c29d5175Schristos * pidpersec.d - print new PIDs per sec. 4*c29d5175Schristos * Written using DTrace (Solaris 10 3/05) 5*c29d5175Schristos * 6*c29d5175Schristos * This script prints the number of new processes created per second. 7*c29d5175Schristos * 8*c29d5175Schristos * $Id: pidpersec.d,v 1.1.1.1 2015/09/30 22:01:09 christos Exp $ 9*c29d5175Schristos * 10*c29d5175Schristos * USAGE: pidpersec.d 11*c29d5175Schristos * 12*c29d5175Schristos * FIELDS: 13*c29d5175Schristos * 14*c29d5175Schristos * TIME Time, as a string 15*c29d5175Schristos * LASTPID Last PID created 16*c29d5175Schristos * PID/s Number of processes created per second 17*c29d5175Schristos * 18*c29d5175Schristos * SEE ALSO: execsnoop 19*c29d5175Schristos * 20*c29d5175Schristos * COPYRIGHT: Copyright (c) 2005 Brendan Gregg. 21*c29d5175Schristos * 22*c29d5175Schristos * CDDL HEADER START 23*c29d5175Schristos * 24*c29d5175Schristos * The contents of this file are subject to the terms of the 25*c29d5175Schristos * Common Development and Distribution License, Version 1.0 only 26*c29d5175Schristos * (the "License"). You may not use this file except in compliance 27*c29d5175Schristos * with the License. 28*c29d5175Schristos * 29*c29d5175Schristos * You can obtain a copy of the license at Docs/cddl1.txt 30*c29d5175Schristos * or http://www.opensolaris.org/os/licensing. 31*c29d5175Schristos * See the License for the specific language governing permissions 32*c29d5175Schristos * and limitations under the License. 33*c29d5175Schristos * 34*c29d5175Schristos * CDDL HEADER END 35*c29d5175Schristos * 36*c29d5175Schristos * 09-Jun-2005 Brendan Gregg Created this. 37*c29d5175Schristos * 09-Jun-2005 " " Last update. 38*c29d5175Schristos */ 39*c29d5175Schristos 40*c29d5175Schristos #pragma D option quiet 41*c29d5175Schristos 42*c29d5175Schristos dtrace:::BEGIN 43*c29d5175Schristos { 44*c29d5175Schristos printf("%-22s %6s\n", "TIME", "PID/s"); 45*c29d5175Schristos pids = 0; 46*c29d5175Schristos } 47*c29d5175Schristos 48*c29d5175Schristos proc:::exec-success 49*c29d5175Schristos { 50*c29d5175Schristos pids++; 51*c29d5175Schristos } 52*c29d5175Schristos 53*c29d5175Schristos profile:::tick-1sec 54*c29d5175Schristos { 55*c29d5175Schristos printf("%-22Y %6d\n", walltimestamp, pids); 56*c29d5175Schristos pids = 0; 57*c29d5175Schristos } 58