/* * CDDL HEADER START * * The contents of this file are subject to the terms of the * Common Development and Distribution License (the "License"). * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. * See the License for the specific language governing permissions * and limitations under the License. * * When distributing Covered Code, include this CDDL HEADER in each * file and include the License file at usr/src/OPENSOLARIS.LICENSE. * If applicable, add the following below this CDDL HEADER, with the * fields enclosed by brackets "[]" replaced with your own identifying * information: Portions Copyright [yyyy] [name of copyright owner] * * CDDL HEADER END */ /* * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* usage: /usr/sbin/dtrace -qs foo.d target_pid will draw graphs on a 10 second timer of the i/o system calls, count versus millisecs, for aioread/aiowrite read/write pread/pwrite. */ /* ----------------- aio code ------------------------------------- */ fbt::aio_req_setup:entry /pid == $1/ { self->alloc1 = args[0]; } fbt::aio_req_setup:return /self->alloc1/ { times[*self->alloc1] = timestamp; self->alloc1 = 0; } fbt::aio_copyout_result:entry /pid == $1 && (times[args[0]] != 0) && ((args[0]->aio_req_buf.b_flags & 0x40) == 0x00)/ { this->a = stringof(strjoin("kaio writes to ",stringof(args[0]->aio_req_buf.b_file->v_path))); @time[this->a] = quantize((timestamp - times[args[0]])/1000000ull); times[args[0]] = 0; } fbt::aio_copyout_result:entry /pid == $1 && (times[args[0]] != 0) && ((args[0]->aio_req_buf.b_flags & 0x40) == 0x40)/ { this->a = stringof(strjoin("kaio reads from ",stringof(args[0]->aio_req_buf.b_file->v_path))); @time[this->a] = quantize((timestamp - times[args[0]])/1000000ull); times[args[0]] = 0; } /* ------------------ normal i/o ------------------------------------ */ fbt::read:entry, fbt::write:entry, fbt::pwrite:entry, fbt::pread:entry /pid == $1 / { self->start = timestamp; self->fname = stringof(strjoin(strjoin(probefunc , " against ") , fds[args[0]].fi_pathname )); } fbt::read:return, fbt::write:return, fbt::pwrite:return, fbt::pread:return / self->start/ { @time[self->fname] = quantize((timestamp - self->start)/1000000ull); self->start = 0; self->fname = 0; } /* ------------------------tick to draw the graphs.------------------------------ */ tick-10sec { printf("------- %d value axis is in millisecs -------\n", timestamp/1000000000); printa(@time); trunc(@time); }