1#!/usr/sbin/dtrace -s 2/* 3 * bitesize.d - analyse disk I/O size by process. 4 * Written using DTrace (Solaris 10 3/05). 5 * 6 * This produces a report for the size of disk events caused by 7 * processes. These are the disk events sent by the block I/O driver. 8 * 9 * If applications must use the disks, we generally prefer they do so 10 * with large I/O sizes. 11 * 12 * 18-Feb-2006, ver 1.11 13 * 14 * USAGE: bitesize.d # wait several seconds, then hit Ctrl-C 15 * 16 * FIELDS: 17 * PID process ID 18 * CMD command and argument list 19 * value size in bytes 20 * count number of I/O operations 21 * 22 * NOTES: 23 * 24 * The application may be requesting smaller sized operations, which 25 * are being rounded up to the nearest sector size or UFS block size. 26 * To analyse what the application is requesting, DTraceToolkit programs 27 * such as Proc/fddist may help. 28 * 29 * SEE ALSO: seeksize.d, iosnoop 30 * 31 * COPYRIGHT: Copyright (c) 2006 Brendan Gregg. 32 * 33 * CDDL HEADER START 34 * 35 * The contents of this file are subject to the terms of the 36 * Common Development and Distribution License, Version 1.0 only 37 * (the "License"). You may not use this file except in compliance 38 * with the License. 39 * 40 * You can obtain a copy of the license at Docs/cddl1.txt 41 * or http://www.opensolaris.org/os/licensing. 42 * See the License for the specific language governing permissions 43 * and limitations under the License. 44 * 45 * CDDL HEADER END 46 * 47 * 31-Mar-2004 Brendan Gregg Created this, build 51. 48 * 10-Oct-2004 " " Rewrote to use the io provider, build 63. 49 */ 50 51#pragma D option quiet 52 53/* 54 * Print header 55 */ 56dtrace:::BEGIN 57{ 58 printf("Tracing... Hit Ctrl-C to end.\n"); 59} 60 61/* 62 * Process io start 63 */ 64io:::start 65{ 66 /* fetch details */ 67 this->size = args[0]->b_bcount; 68 69 /* store details */ 70 @Size[pid, curpsinfo->pr_psargs] = quantize(this->size); 71} 72 73/* 74 * Print final report 75 */ 76dtrace:::END 77{ 78 printf("\n%8s %s\n", "PID", "CMD"); 79 printa("%8d %S\n%@d\n", @Size); 80} 81 82