3 * pridist.d - process priority distribution.
4 * Written using DTrace (Solaris 10 3/05)
6 * This is a simple DTrace script that samples at 1000 Hz which process
7 * is on the CPUs, and what the priority is. A distribution plot is printed.
9 * With priorities, the higher the priority the better chance the process
10 * (actually, thread) has of being scheduled.
12 * This idea came from the script /usr/demo/dtrace/profpri.d, which
13 * produces similar output for one particular PID.
15 * $Id: pridist.d 3 2007-08-01 10:50:08Z brendan $
17 * USAGE: pridist.d # hit Ctrl-C to end sampling
22 * value process priority
23 * count number of samples of at least this priority
25 * BASED ON: /usr/demo/dtrace/profpri.d
28 * DTrace Guide "profile Provider" chapter (docs.sun.com)
31 * PORTIONS: Copyright (c) 2005 Brendan Gregg.
35 * The contents of this file are subject to the terms of the
36 * Common Development and Distribution License, Version 1.0 only
37 * (the "License"). You may not use this file except in compliance
40 * You can obtain a copy of the license at Docs/cddl1.txt
41 * or http://www.opensolaris.org/os/licensing.
42 * See the License for the specific language governing permissions
43 * and limitations under the License.
47 * 13-Jun-2005 Brendan Gregg Created this.
48 * 22-Apr-2006 " " Last update.
51 #pragma D option quiet
55 printf("Sampling... Hit Ctrl-C to end.\n");
58 profile:::profile-1000hz
60 @Count[execname, pid] = lquantize(curlwpsinfo->pr_pri, 0, 170, 5);
65 printa(" CMD: %-16s PID: %d\n%@d\n", @Count);