This is a stupid simple diff to see just how much time you spend
waiting for your disk. If you're into measuring that kind of thing.

Index: vfs_bio.c
===================================================================
RCS file: /cvs/src/sys/kern/vfs_bio.c,v
retrieving revision 1.146
diff -u -p -r1.146 vfs_bio.c
--- vfs_bio.c   17 Feb 2013 17:39:29 -0000      1.146
+++ vfs_bio.c   5 Apr 2013 01:34:03 -0000
@@ -1153,6 +1153,8 @@ buf_daemon(struct proc *p)
        }
 }
 
+uint64_t biowaittime;
+
 /*
  * Wait for operations on the buffer to complete.
  * When they do, extract and return the I/O's error value.
@@ -1161,12 +1163,18 @@ int
 biowait(struct buf *bp)
 {
        int s;
+       struct timespec before, after, diff;
 
        KASSERT(!(bp->b_flags & B_ASYNC));
 
        s = splbio();
+       nanotime(&before);
        while (!ISSET(bp->b_flags, B_DONE))
                tsleep(bp, PRIBIO + 1, "biowait", 0);
+       nanotime(&after);
+       timespecsub(&after, &before, &diff);
+       biowaittime += diff.tv_nsec;
+       biowaittime += diff.tv_sec * 1000000000L;
        splx(s);
 
        /* check for interruption of I/O (e.g. via NFS), then errors. */

Reply via email to