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 * 22-Apr-2006, ver 1.00 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 */ 54 55#pragma D option quiet 56 57dtrace:::BEGIN 58{ 59 printf("Sampling... Hit Ctrl-C to end.\n"); 60} 61 62profile:::profile-1000hz 63{ 64 @count[stringof(curlwpsinfo->pr_clname)] 65 = lquantize(curlwpsinfo->pr_pri, 0, 100, 5); 66} 67