diff -ur linux-2.2.18/fs/proc/array.c linux/fs/proc/array.c --- linux-2.2.18/fs/proc/array.c Wed Dec 13 11:43:28 2000 +++ linux/fs/proc/array.c Tue Feb 27 11:52:52 2001 @@ -274,6 +274,8 @@ "disk_wio %u %u %u %u\n" "disk_rblk %u %u %u %u\n" "disk_wblk %u %u %u %u\n" + "read %u %u\n" /* added by FvH: needed for sar-statistics */ + "write %u %u\n" /* read/write n nbytes */ "page %u %u\n" #ifdef CONFIG_ARCH_S390 "swap %u %u\n" @@ -290,6 +292,8 @@ "disk_wio %u %u %u %u\n" "disk_rblk %u %u %u %u\n" "disk_wblk %u %u %u %u\n" + "read %u %u\n" /* added by FvH: needed for sar-statistics */ + "write %u %u\n" /* read/write n nbytes */ "page %u %u\n" #ifdef CONFIG_ARCH_S390 "swap %u %u\n" @@ -313,6 +317,8 @@ kstat.dk_drive_rblk[2], kstat.dk_drive_rblk[3], kstat.dk_drive_wblk[0], kstat.dk_drive_wblk[1], kstat.dk_drive_wblk[2], kstat.dk_drive_wblk[3], + kstat.n_reads, kstat.n_reads_cnt, + kstat.n_writes, kstat.n_writes_cnt, kstat.pgpgin, kstat.pgpgout, kstat.pswpin, diff -ur linux-2.2.18/fs/read_write.c linux/fs/read_write.c --- linux-2.2.18/fs/read_write.c Mon Sep 4 19:39:27 2000 +++ linux/fs/read_write.c Tue Feb 27 11:49:27 2001 @@ -2,6 +2,11 @@ * linux/fs/read_write.c * * Copyright (C) 1991, 1992 Linus Torvalds + * + * Additions by FvH: read[v]/write[v] now keep track + * of the number of reads/writes and the number of bytes + * read or written. Needed to be able to do some thorough + * analysis. */ #include @@ -10,6 +15,7 @@ #include #include #include +#include #include @@ -121,6 +127,9 @@ lock_kernel(); + kstat.n_reads++; /* for sar statistics */ + kstat.n_reads_cnt += count; + ret = -EBADF; file = fget(fd); if (!file) @@ -151,6 +160,9 @@ lock_kernel(); + kstat.n_writes++; /* for sar statistics */ + kstat.n_writes_cnt += count; + ret = -EBADF; file = fget(fd); if (!file) @@ -230,6 +242,17 @@ ? FLOCK_VERIFY_READ : FLOCK_VERIFY_WRITE), inode, file, file->f_pos, tot_len); if (ret) goto out; + + if (type == VERIFY_READ) + { + kstat.n_reads++; /* for sar statistics */ + kstat.n_reads_cnt += tot_len; + } + else + { + kstat.n_writes++; /* for sar statistics */ + kstat.n_writes_cnt += tot_len; + } /* * Then do the actual IO. Note that sockets need to be handled diff -ur linux-2.2.18/include/linux/kernel_stat.h linux/include/linux/kernel_stat.h --- linux-2.2.18/include/linux/kernel_stat.h Wed Dec 13 12:03:16 2000 +++ linux/include/linux/kernel_stat.h Tue Feb 27 11:46:09 2001 @@ -32,6 +32,8 @@ unsigned int ierrors, oerrors; unsigned int collisions; unsigned int context_swtch; + unsigned int n_reads, n_writes; + unsigned int n_reads_cnt, n_writes_cnt; }; extern struct kernel_stat kstat;