[Patch][RFC][RFT] Get consistent disk paging data with /proc/stat

Uwe Bonnes (bon@elektron.ikp.physik.tu-darmstadt.de)
Sun, 26 Sep 1999 14:59:04 +0200 (MEST)


[RFT]: Request for testers :-)

Hallo,

at present /proc/stat reports in the "page" line the number of calls
made to make_request. As the number of 512 bytes records belonging to one
request varies ( 2 for a normal harddisk, 4 for a SCSI CDROM,
probably 8 for a md-device), this accumulated number doesn't reflect a
real hard number tranfered to and from the media. I propose counting
the number of records instead. This would require a change to xosview,
or otherwise the numbers for normal disk accesses would off by a
factor of two.

Any objections

Bye

Uwe Bonnes bon@elektron.ikp.physik.tu-darmstadt.de

Free Software: If you contribute nothing, expect nothing

--
--- linux/drivers/block/ll_rw_blk.c~    Sun Sep 26 13:57:53 1999
+++ linux/drivers/block/ll_rw_blk.c     Sun Sep 26 14:04:54 1999
@@ -456,7 +456,7 @@
                case READ:
                        if (buffer_uptodate(bh)) /* Hmmph! Already have it */
                                goto end_io;
-                       kstat.pgpgin++;
+                       kstat.pgpgin+=count;
                        max_req = NR_REQUEST;   /* reads take precedence */
                        break;
                case WRITEA:
@@ -470,7 +470,7 @@
                         * as they take precedence. The last third of the
                         * requests are only for reads.
                         */
-                       kstat.pgpgout++;
+                       kstat.pgpgout+=count;
                        max_req = (NR_REQUEST * 2) / 3;
                        break;
                default:
--- xosview-1.7.1/linux/diskmeter.cc.orig       Thu Feb 25 18:12:41 1999
+++ xosview-1.7.1/linux/diskmeter.cc    Fri May  7 20:37:18 1999
@@ -73,8 +73,8 @@
     // assume each "unit" is 1k. 
     // This is true for ext2, but seems to be 512 bytes 
     // for vfat and 2k for cdroms
-    unsigned long int read_curr = one * 1024;
-    unsigned long int write_curr = two * 1024;
+    unsigned long int read_curr = one * 512;
+    unsigned long int write_curr = two * 512;
 
     fields_[0] = ((read_curr - read_prev_) * 1e6) / IntervalTimeInMicrosecs();
     fields_[1] = ((write_curr - write_prev_) * 1e6) / 

(In may, I mailed this patch several times to Linus direct, but got no feedback. The author of xosview mailed me that he liked that patch.)

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/