lkml.org 
[lkml]   [1999]   [Dec]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Date
SubjectPATCH against 2.2.13: disk io stats in /proc/stat

I was looking around for a utility to give me some
stats on my disk io. Something like iostat in Solaris.

Well, I found that /proc/stat only reports stats
for 4 disks. I'm not sure why that limitation exists,
but then I learned from Ted T'so that /proc/stat
is problematic in other ways.

A kernel instance only maintains a single
struct kernel_stat and thus io's into the indexed
dk_drive_rio, for instance are differentiated by
device. Io's to /dev/hda1 and /dev/sda1 are
comingled, and thus corrupted. At least that's
how I'm reading this code.

I made up this one patch which I believe ups the
number of devices reported in /proc/stat to 16.
But the problem of the undifferentiated devices
is a larger fish. Could we break up the indices
for io stats in kernel_stat into categories pertaining
to device types?

Any thoughts?

Thanks


ari






--- fs/proc/array.c.orig Mon Dec 20 21:25:32 1999
+++ fs/proc/array.c Mon Dec 20 21:35:51 1999
@@ -270,22 +270,22 @@
+ kstat.per_cpu_nice[cpu_logical_map(i)] \
+ kstat.per_cpu_system[cpu_logical_map(i)]));
len += sprintf(buffer + len,
- "disk %u %u %u %u\n"
- "disk_rio %u %u %u %u\n"
- "disk_wio %u %u %u %u\n"
- "disk_rblk %u %u %u %u\n"
- "disk_wblk %u %u %u %u\n"
+ "disk %u %u %u %u %u %u %u %u %u %u %u %u %u %u %u %u\n"
+ "disk_rio %u %u %u %u %u %u %u %u %u %u %u %u %u %u %u %u\n"
+ "disk_wio %u %u %u %u %u %u %u %u %u %u %u %u %u %u %u %u\n"
+ "disk_rblk %u %u %u %u %u %u %u %u %u %u %u %u %u %u %u %u\n"
+ "disk_wblk %u %u %u %u %u %u %u %u %u %u %u %u %u %u %u %u\n"
"page %u %u\n"
"swap %u %u\n"
"intr %u",
#else
len = sprintf(buffer,
"cpu %u %u %u %lu\n"
- "disk %u %u %u %u\n"
- "disk_rio %u %u %u %u\n"
- "disk_wio %u %u %u %u\n"
- "disk_rblk %u %u %u %u\n"
- "disk_wblk %u %u %u %u\n"
+ "disk %u %u %u %u %u %u %u %u %u %u %u %u %u %u %u %u\n"
+ "disk_rio %u %u %u %u %u %u %u %u %u %u %u %u %u %u %u %u\n"
+ "disk_wio %u %u %u %u %u %u %u %u %u %u %u %u %u %u %u %u\n"
+ "disk_rblk %u %u %u %u %u %u %u %u %u %u %u %u %u %u %u %u\n"
+ "disk_wblk %u %u %u %u %u %u %u %u %u %u %u %u %u %u %u %u\n"
"page %u %u\n"
"swap %u %u\n"
"intr %u",
@@ -296,14 +296,44 @@
#endif
kstat.dk_drive[0], kstat.dk_drive[1],
kstat.dk_drive[2], kstat.dk_drive[3],
+ kstat.dk_drive[4], kstat.dk_drive[5],
+ kstat.dk_drive[6], kstat.dk_drive[7],
+ kstat.dk_drive[8], kstat.dk_drive[9],
+ kstat.dk_drive[10], kstat.dk_drive[11],
+ kstat.dk_drive[12], kstat.dk_drive[13],
+ kstat.dk_drive[14], kstat.dk_drive[15],
kstat.dk_drive_rio[0], kstat.dk_drive_rio[1],
kstat.dk_drive_rio[2], kstat.dk_drive_rio[3],
+ kstat.dk_drive_rio[4], kstat.dk_drive_rio[5],
+ kstat.dk_drive_rio[6], kstat.dk_drive_rio[7],
+ kstat.dk_drive_rio[8], kstat.dk_drive_rio[9],
+ kstat.dk_drive_rio[10], kstat.dk_drive_rio[11],
+ kstat.dk_drive_rio[12], kstat.dk_drive_rio[13],
+ kstat.dk_drive_rio[14], kstat.dk_drive_rio[15],
kstat.dk_drive_wio[0], kstat.dk_drive_wio[1],
kstat.dk_drive_wio[2], kstat.dk_drive_wio[3],
+ kstat.dk_drive_wio[4], kstat.dk_drive_wio[5],
+ kstat.dk_drive_wio[6], kstat.dk_drive_wio[7],
+ kstat.dk_drive_wio[8], kstat.dk_drive_wio[9],
+ kstat.dk_drive_wio[10], kstat.dk_drive_wio[11],
+ kstat.dk_drive_wio[12], kstat.dk_drive_wio[13],
+ kstat.dk_drive_wio[14], kstat.dk_drive_wio[15],
kstat.dk_drive_rblk[0], kstat.dk_drive_rblk[1],
kstat.dk_drive_rblk[2], kstat.dk_drive_rblk[3],
+ kstat.dk_drive_rblk[4], kstat.dk_drive_rblk[5],
+ kstat.dk_drive_rblk[6], kstat.dk_drive_rblk[7],
+ kstat.dk_drive_rblk[8], kstat.dk_drive_rblk[9],
+ kstat.dk_drive_rblk[10], kstat.dk_drive_rblk[11],
+ kstat.dk_drive_rblk[12], kstat.dk_drive_rblk[13],
+ kstat.dk_drive_rblk[14], kstat.dk_drive_rblk[15],
kstat.dk_drive_wblk[0], kstat.dk_drive_wblk[1],
kstat.dk_drive_wblk[2], kstat.dk_drive_wblk[3],
+ kstat.dk_drive_wblk[4], kstat.dk_drive_wblk[5],
+ kstat.dk_drive_wblk[6], kstat.dk_drive_wblk[7],
+ kstat.dk_drive_wblk[8], kstat.dk_drive_wblk[9],
+ kstat.dk_drive_wblk[10], kstat.dk_drive_wblk[11],
+ kstat.dk_drive_wblk[12], kstat.dk_drive_wblk[13],
+ kstat.dk_drive_wblk[14], kstat.dk_drive_wblk[15],
kstat.pgpgin,
kstat.pgpgout,
kstat.pswpin,
--- include/linux/kernel_stat.h.orig Mon Dec 20 21:42:25 1999
+++ include/linux/kernel_stat.h Mon Dec 20 23:41:39 1999
@@ -11,7 +11,7 @@
* used by rstatd/perfmeter
*/

-#define DK_NDRIVE 4
+#define DK_NDRIVE 16

struct kernel_stat {
unsigned int cpu_user, cpu_nice, cpu_system;
--- drivers/block/ll_rw_blk.c.orig Mon Dec 20 21:50:58 1999
+++ drivers/block/ll_rw_blk.c Mon Dec 20 21:44:06 1999
@@ -324,7 +324,7 @@
break;
case SCSI_DISK0_MAJOR:
disk_index = (minor & 0x00f0) >> 4;
- if (disk_index < 4)
+ if (disk_index < DK_NDRIVE)
drive_stat_acct(req->cmd, req->nr_sectors, disk_index);
break;
case IDE0_MAJOR: /* same as HD_MAJOR */
\
 
 \ /
  Last update: 2005-03-22 13:55    [W:0.059 / U:0.580 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site