1120723Sbms#!/usr/sbin/dtrace -s
2120723Sbms/*
3120723Sbms * dispqlen.d - dispatcher queue length by CPU.
4120723Sbms *              Written using DTrace (Solaris 10 3/05).
5120723Sbms *
6120723Sbms * $Id: dispqlen.d 3 2007-08-01 10:50:08Z brendan $
7120723Sbms *
8120723Sbms * USAGE:	dispqlen.d		# hit Ctrl-C to end sample
9120723Sbms *
10120723Sbms * NOTES: The dispatcher queue length is an indication of CPU saturation.
11120723Sbms * It is not an indicatior of utilisation - the CPUs may or may not be
12120723Sbms * utilised when the dispatcher queue reports a length of zero.
13120723Sbms *
14120723Sbms * SEE ALSO:    uptime(1M)
15120723Sbms *
16120723Sbms * COPYRIGHT: Copyright (c) 2005 Brendan Gregg.
17120723Sbms *
18120723Sbms * CDDL HEADER START
19120723Sbms *
20120723Sbms *  The contents of this file are subject to the terms of the
21120723Sbms *  Common Development and Distribution License, Version 1.0 only
22120723Sbms *  (the "License").  You may not use this file except in compliance
23120723Sbms *  with the License.
24120723Sbms *
25120723Sbms *  You can obtain a copy of the license at Docs/cddl1.txt
26120723Sbms *  or http://www.opensolaris.org/os/licensing.
27120723Sbms *  See the License for the specific language governing permissions
28120723Sbms *  and limitations under the License.
29120723Sbms *
30131681Sru * CDDL HEADER END
31120723Sbms *
32120723Sbms * 27-Jun-2005  Brendan Gregg   Created this.
33120723Sbms * 14-Feb-2006	   "      "	Last update.
34120723Sbms */
35120723Sbms
36120723Sbms#pragma D option quiet
37120723Sbms
38120723Sbmsdtrace:::BEGIN
39131682Sru{
40120723Sbms	printf("Sampling... Hit Ctrl-C to end.\n");
41120723Sbms}
42131682Sru
43120723Sbmsprofile:::profile-1000hz
44120723Sbms{
45120723Sbms	@queue[cpu] =
46120723Sbms	    lquantize(curthread->t_cpu->cpu_disp->disp_nrunnable, 0, 64, 1);
47120723Sbms}
48120723Sbms
49120723Sbmsdtrace:::END
50120723Sbms{
51120723Sbms	printa(" CPU %d%@d\n", @queue);
52120723Sbms}
53120723Sbms