dispqlen.d revision 259065
1146572Sharti#!/usr/sbin/dtrace -s
2146572Sharti/*
3146572Sharti * dispqlen.d - dispatcher queue length by CPU.
4146572Sharti *              Written using DTrace (Solaris 10 3/05).
5146572Sharti *
6146572Sharti * $Id: dispqlen.d 3 2007-08-01 10:50:08Z brendan $
7146572Sharti *
8146572Sharti * USAGE:	dispqlen.d		# hit Ctrl-C to end sample
9146572Sharti *
10146572Sharti * NOTES: The dispatcher queue length is an indication of CPU saturation.
11146572Sharti * It is not an indicatior of utilisation - the CPUs may or may not be
12146572Sharti * utilised when the dispatcher queue reports a length of zero.
13146572Sharti *
14146572Sharti * SEE ALSO:    uptime(1M)
15146572Sharti *
16146572Sharti * COPYRIGHT: Copyright (c) 2005 Brendan Gregg.
17146572Sharti *
18146572Sharti * CDDL HEADER START
19146572Sharti *
20146572Sharti *  The contents of this file are subject to the terms of the
21146572Sharti *  Common Development and Distribution License, Version 1.0 only
22146572Sharti *  (the "License").  You may not use this file except in compliance
23146572Sharti *  with the License.
24146572Sharti *
25146572Sharti *  You can obtain a copy of the license at Docs/cddl1.txt
26146572Sharti *  or http://www.opensolaris.org/os/licensing.
27146572Sharti *  See the License for the specific language governing permissions
28146572Sharti *  and limitations under the License.
29146572Sharti *
30146572Sharti * CDDL HEADER END
31146572Sharti *
32146572Sharti * 27-Jun-2005  Brendan Gregg   Created this.
33146572Sharti * 14-Feb-2006	   "      "	Last update.
34146572Sharti */
35146572Sharti
36146572Sharti#pragma D option quiet
37146572Sharti
38146572Shartidtrace:::BEGIN
39146572Sharti{
40146572Sharti	printf("Sampling... Hit Ctrl-C to end.\n");
41146572Sharti}
42146572Sharti
43146572Shartiprofile:::profile-1000hz
44146572Sharti{
45146572Sharti	@queue[cpu] =
46146572Sharti	    lquantize(curthread->t_cpu->cpu_disp->disp_nrunnable, 0, 64, 1);
47146572Sharti}
48146572Sharti
49146572Shartidtrace:::END
50146572Sharti{
51146572Sharti	printa(" CPU %d%@d\n", @queue);
52146572Sharti}
53146572Sharti