Hi, There was a requirement to measure all the OSYNC writes. Attached is a simple DTrace script which does this using the fsinfo provider and fbt::fop_write.
I was wondering if this accurate enough or if I missed any other cases. I am sure this can be improved in many ways. Thanks and regards, Sanjeev
#!/usr/sbin/dtrace -Cs /* 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. * * You can obtain a copy of the license at Docs/cddl1.txt * or http://www.opensolaris.org/os/licensing. * See the License for the specific language governing permissions * and limitations under the License. * * CDDL HEADER END * * Author: Sanjeev Bagewadi [Bangalore, India] */ #pragma D option quiet #include <sys/file.h> BEGIN { secs = 10; } fbt::fop_write:entry /arg2 & (FSYNC | FDSYNC)/ { self->trace = 1; } fbt::fop_write:return /self->trace/ { self->trace = 0; } fsinfo::fop_write:write /self->trace/ { vp = (vnode_t *) arg0; vfs = (vfs_t *) vp->v_vfsp; mnt_pt = (char *)((refstr_t *)vfs->vfs_mntpt->rs_string); uio = (uio_t *) arg1; /*...@writes[stringof(mnt_pt)] = sum(uio->uio_resid);*/ @writes[args[0]->fi_mount] = sum(args[1]); } tick-1s /secs != 0/ { secs--; } tick-1s /secs == 0/ { exit(0); } END { printa("%s %...@8d\n", @writes); }
_______________________________________________ zfs-discuss mailing list zfs-discuss@opensolaris.org http://mail.opensolaris.org/mailman/listinfo/zfs-discuss