/*
* Written using DTrace (Solaris 10 3/05)
*
* This traces file related activity: system call reads and writes,
* vnode logical read and writes (fop), and disk I/O. It can be used
* to examine the behaviour of each I/O layer, from the syscall
* interface to what the disk is doing. Behaviour such as read-ahead, and
* max I/O size breakup can be observed.
*
* $Id: fsrw.d 3 2007-08-01 10:50:08Z brendan $
*
* USAGE: fsrw.d
*
* FIELDS:
* Event Traced event (see EVENTS below)
* Device Device, for disk I/O
* RW Either Read or Write
* Size Size of I/O in bytes
* Offset Offset of I/O in kilobytes
* Path Path to file on disk
*
* EVENTS:
* sc-read System call read
* sc-write System call write
* fop_read Logical read
* fop_write Logical write
* disk_io Physical disk I/O
* disk_ra Physical disk I/O, read ahead
*
* The events are drawn with a level of indentation, which can sometimes
* help identify related events.
*
* SEE ALSO: fspaging.d
*
* IDEA: Richard McDougall, Solaris Internals 2nd Ed, FS Chapter.
*
* COPYRIGHT: Copyright (c) 2006 Brendan Gregg.
*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* See the License for the specific language governing permissions
* and limitations under the License.
*
* CDDL HEADER END
*
* ToDo: readv()
*
* 20-Mar-2006 Brendan Gregg Created this.
* 23-Apr-2006 " " Last update.
*/
{
printf("%-12s %10s %2s %8s %6s %s\n",
"Event", "Device", "RW", "Size", "Offset", "Path");
}
{
/*
* starting with a file descriptior, dig out useful info
* from the corresponding file_t and vnode_t.
*/
/* only trace activity to regular files and directories, as */
}
{
}
{
}
{
}
{
}
{
/* fetch the real offset (file_t is unaware of this) */
}
{
self->read_ahead = 0;
}
{
printf(" %-8s %10s %2s %8d %6d %s\n",
/*
* it would seem to make sense to only trace disk events during
* an fop event, easily coded with a self->fop_trace flag. However
* writes are asynchronous to the fop_write calls (they are flushed
* at some later time), and so this approach will miss tracing
* most of the disk writes.
*/
}