seeksize.d revision 1
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * seeksize.d - analyse disk head seek distance by process.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Written using DTrace (Solaris 10 3/05).
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Disk I/O events caused by processes will in turn cause the disk heads
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * to seek. This program analyses those seeks, so that we can determine
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * if processes are causing the disks to seek in a "random" or "sequential"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * $Id: seeksize.d 3 2007-08-01 10:50:08Z brendan $
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * USAGE: seeksize.d # wait several seconds, then hit Ctrl-C
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * PID process ID
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * CMD command and argument list
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * value distance in disk blocks (sectors)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * count number of I/O operations
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * SEE ALSO: bitesize.d, iosnoop
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * COPYRIGHT: Copyright (c) 2006 Brendan Gregg.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * CDDL HEADER START
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * The contents of this file are subject to the terms of the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Common Development and Distribution License, Version 1.0 only
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * (the "License"). You may not use this file except in compliance
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * with the License.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * You can obtain a copy of the license at Docs/cddl1.txt
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * See the License for the specific language governing permissions
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * and limitations under the License.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * CDDL HEADER END
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * 11-Sep-2004 Brendan Gregg Created this.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * 10-Oct-2004 " " Rewrote to use the io provider.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * 20-Apr-2006 " " Last update.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Print header
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Process io start
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* calculate seek distance */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte this->dist = (int)(args[0]->b_blkno - this->last) > 0 ?
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte args[0]->b_blkno - this->last : this->last - args[0]->b_blkno;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* store details */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte @Size[pid, curpsinfo->pr_psargs] = quantize(this->dist);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* save last position of disk head */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Print final report