]> CyberLeo.Net >> Repos - FreeBSD/stable/10.git/blob - cddl/contrib/dtracetoolkit/Kernel/priclass.d
Copy head (r256279) to stable/10 as part of the 10.0-RELEASE cycle.
[FreeBSD/stable/10.git] / cddl / contrib / dtracetoolkit / Kernel / priclass.d
1 #!/usr/sbin/dtrace -s
2 /*
3  * priclass.d - priority distribution by scheduling class.
4  *              Written using DTrace (Solaris 10 3/05)
5  *
6  * This is a simple DTrace script that samples at 1000 Hz the current
7  * thread's scheduling class and priority. A distribution plot is printed.
8  *
9  * With priorities, the higher the priority the better chance the thread
10  * has of being scheduled.
11  *
12  * This idea came from the script /usr/demo/dtrace/pri.d, which
13  * produces similar output for priority changes, not samples.
14  *
15  * $Id: priclass.d 3 2007-08-01 10:50:08Z brendan $
16  *
17  * USAGE:       priclass.d      # hit Ctrl-C to end sampling
18  *
19  * FIELDS:
20  *              value           process priority
21  *              count           number of samples of at least this priority
22  *
23  * Also printed is the scheduling class,
24  *
25  *              TS              time sharing
26  *              IA              interactive
27  *              RT              real time
28  *              SYS             system
29  *              FSS             fair share schedular
30  *
31  * BASED ON: /usr/demo/dtrace/pri.d
32  *
33  * SEE ALSO: DTrace Guide "profile Provider" chapter (docs.sun.com)
34  *           dispadmin(1M)
35  *
36  * PORTIONS: Copyright (c) 2006 Brendan Gregg.
37  *
38  * CDDL HEADER START
39  *
40  *  The contents of this file are subject to the terms of the
41  *  Common Development and Distribution License, Version 1.0 only
42  *  (the "License").  You may not use this file except in compliance
43  *  with the License.
44  *
45  *  You can obtain a copy of the license at Docs/cddl1.txt
46  *  or http://www.opensolaris.org/os/licensing.
47  *  See the License for the specific language governing permissions
48  *  and limitations under the License.
49  *
50  * CDDL HEADER END
51  *
52  * 12-Feb-2006  Brendan Gregg   Created this.
53  * 22-Apr-2006     "      "     Last update.
54  */
55
56 #pragma D option quiet
57
58 dtrace:::BEGIN
59 {
60         printf("Sampling... Hit Ctrl-C to end.\n");
61 }
62
63 profile:::profile-1000hz
64 {
65         @count[stringof(curlwpsinfo->pr_clname)]
66             = lquantize(curlwpsinfo->pr_pri, 0, 170, 10);
67 }