1#!/usr/sbin/dtrace -s 2/* 3 * hotspot.d - plot disk event by location, look for hotspots. 4 * Written in DTrace (Solaris 10 3/05). 5 * 6 * This simple DTrace script determines if disk activity is occuring in 7 * the one place - a "hotspot". This helps us understand the system's usage 8 * of a disk, it does not imply that the existance or not of a hotspot is 9 * good or bad (often may be good, less seeking). 10 * 11 * 20-Apr-2006, ver 0.81 12 * 13 * 14 * USAGE: hotspot.d # hit Ctrl-C to end 15 * 16 * FIELDS: 17 * Disk disk instance name 18 * Major driver major number 19 * Minor driver minor number 20 * value location, by megabyte 21 * count number of I/O operations 22 * 23 * COPYRIGHT: Copyright (c) 2005, 2006 Brendan Gregg. 24 * 25 * CDDL HEADER START 26 * 27 * The contents of this file are subject to the terms of the 28 * Common Development and Distribution License, Version 1.0 only 29 * (the "License"). You may not use this file except in compliance 30 * with the License. 31 * 32 * You can obtain a copy of the license at Docs/cddl1.txt 33 * or http://www.opensolaris.org/os/licensing. 34 * See the License for the specific language governing permissions 35 * and limitations under the License. 36 * 37 * CDDL HEADER END 38 * 39 * 07-May-2005 Brendan Gregg Created this. 40 */ 41 42#pragma D option quiet 43 44inline int DISK_MB_MAX = 1000000; /* max size of a single disk */ 45inline int REPORT_SCALE_MB = 1000; /* output step size for report */ 46 47/* 48 * Print header 49 */ 50dtrace:::BEGIN 51{ 52 printf("Tracing... Hit Ctrl-C to end.\n"); 53} 54 55/* 56 * Process disk event 57 */ 58io:::start 59{ 60 this->mb = args[0]->b_blkno / 2048; 61 @Block[args[1]->dev_statname, args[1]->dev_major, args[1]->dev_minor] = 62 lquantize(this->mb, 0, DISK_MB_MAX, REPORT_SCALE_MB); 63} 64 65/* 66 * Print final report 67 */ 68dtrace:::END 69{ 70 printa("Disk: %s Major,Minor: %d,%d\n%@d\n", @Block); 71} 72 73