]> granicus.if.org Git - procps-ng/commitdiff
vmstat does IO-wait
authoralbert <>
Sat, 9 Nov 2002 02:00:52 +0000 (02:00 +0000)
committeralbert <>
Sat, 9 Nov 2002 02:00:52 +0000 (02:00 +0000)
NEWS
proc/module.mk
top.c
vmstat.8
vmstat.c

diff --git a/NEWS b/NEWS
index a8c5a6dc2f5a41cabfe810fc493c0ee83f27ed76..4cf51b66653b705f59a8479ba4c33e1e7a3da745 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,9 +1,11 @@
 procps-3.0.5 --> procps-3.0.6
 
+vmstat displays IO-wait time instead of bogus "w"
 can build w/o shared library (set SHARED=0)
 when IO-wait hidden, count as idle, not as sys
 pmap command added (like Sun has)
 do not crash GNU make 3.79
+top slightly faster
 
 procps-3.0.4 --> procps-3.0.5
 
index f7d1fe4c0e57a9a0e3d10bf146ed6369c57178a2..f405accd1d40c7146f057ca112feba188c5dd164 100644 (file)
@@ -25,7 +25,7 @@ LIBPROC    := proc/lib$(NAME).a
 endif
 
 # Separate rule for this directory, to use -fpic or -fPIC
-$(LIBOBJ): proc/%.o: proc/%.c
+$(filter-out proc/version.o,$(LIBOBJ)): proc/%.o: proc/%.c
        $(CC) -c $(CFLAGS) $(FPIC) $< -o $@
 
 LIB_X := COPYING module.mk
@@ -70,8 +70,4 @@ $(lib)/$(SONAME) : proc/$(SONAME)
 
 
 proc/version.o:        proc/version.c proc/version.h
-ifdef MINORVERSION
-       $(strip $(CC) $(CFLAGS) -DVERSION=\"$(VERSION)\" -DSUBVERSION=\"$(SUBVERSION)\" -DMINORVERSION=\"$(MINORVERSION)\" -c -o $@ $<)
-else
-       $(strip $(CC) $(CFLAGS) -DVERSION=\"$(VERSION)\" -DSUBVERSION=\"$(SUBVERSION)\" -c -o $@ $<)
-endif
+       $(CC) $(CFLAGS) $(FPIC) -DVERSION=\"$(VERSION)\" -DSUBVERSION=\"$(SUBVERSION)\" -DMINORVERSION=\"$(MINORVERSION)\" -c -o $@ $<
diff --git a/top.c b/top.c
index ea7acbd15f4cc1832ccb7e2c6291028a98344e14..271e5e141bd5c9a6994043263ed437cb9fbcb37e 100644 (file)
--- a/top.c
+++ b/top.c
@@ -711,7 +711,7 @@ static const char *scale_tics (TICS_t tics, const int width)
    unsigned cc;         // centiseconds
    unsigned nn;         // multi-purpose whatever
 
-   nt  = (tics * 100) / Hertz;
+   nt  = (tics * 100ull) / Hertz;
    cc  = nt % 100;                              // centiseconds past second
    nt /= 100;                                   // total seconds
    nn  = nt % 60;                               // seconds past the minute
index d44ec6ce62baa2d0ab762fa669d4f8f38419c27d..0533320a456c2c367f788fbfba344259a5d39fd3 100644 (file)
--- a/vmstat.8
+++ b/vmstat.8
@@ -41,8 +41,6 @@ The \fB-V\fP switch results in displaying version information.
 .nf
 r: The number of processes waiting for run time.  
 b: The number of processes in uninterruptable sleep.
-w: The number of processes swapped out but otherwise runnable.  This 
-   field is calculated, but Linux never desperation swaps.
 .fi
 .PP
 .SS
@@ -81,9 +79,10 @@ cs: The number of context switches per second.
 .B "CPU "
 These are percentages of total CPU time.
 .nf
-us: user time
-sy: system time
-id: idle time 
+us: Time spent running non-kernel code. (user time, including nice time)
+sy: Time spent running kernel code. (system time)
+id: Time spent idle. Prior to Linux 2.5.41, this includes IO-wait time.
+wa: Time spent waiting for IO. Prior to Linux 2.5.41, shown as zero.
 .nf
 .SH NOTES
 .B "vmstat "
@@ -93,7 +92,8 @@ These reports are intended to help identify system bottlenecks.  Linux
 .B "vmstat "
 does not count itself as a running process.
 .PP
-All linux blocks are currently 1k, except for CD-ROM blocks which are 2k.
+All linux blocks are currently 1024 bytes. Old kernels may report
+blocks as 512 bytes, 2048 bytes, or 4096 bytes.
 .PP
 .SH FILES
 .ta
index 29c0a50a9e58737ebd03c29ef7364d6c4290395c..853240f50abda2ad9a6370d29c9a49a8d2f226c2 100644 (file)
--- a/vmstat.c
+++ b/vmstat.c
@@ -155,6 +155,8 @@ static void getrunners(unsigned int *running, unsigned int *blocked,
 
 
 //////////////////////////////////////////////////////////////////////////////////////
+#if 0
+
 static void old_header(void){
   printf("%8s%28s%10s%12s%11s%9s\n",
         "procs","memory","swap","io","system","cpu");
@@ -253,10 +255,11 @@ static void old_format(void) {
     );
   }
 }
-
+#endif
 
 //////////////////////////////////////////////////////////////////////////////////////
 
+#if 0
 // produce:  "  6  ", "123  ", "123k ", etc.
 static int format_1024(unsigned long long val64, char *dst){
   unsigned oldval;
@@ -321,21 +324,19 @@ static int format_1000(unsigned long long val64, char *dst){
   }
   return sprintf(dst, "%3u%c ", val32, suffix[level]);
 }
-
-
-/*
-procs -----------memory---------- --swap-   ----io---  ---system---  ---cpu---
- r  b   swpd   free   buff  cache  si  so    bi    bo   in    cs  us  sy  id  wa
-*/
+#endif
 
 static void new_header(void){
-  printf("%5s%28s%10s%12s%11s%12s\n",
-        "procs","memory","swap","io","system","cpu");
-  printf("%2s %2s %2s %6s %6s %6s %6s %4s %4s %5s %5s %4s %5s %2s %2s %2s %2s\n",
-        "r","b","w","swpd","free",
-        a_option?"inact":"buff", a_option?"active":"cache",
-        "si","so","bi","bo",
-        "in","cs","us","sy","id","wa");
+  printf("procs -----------memory---------- ---swap-- -----io---- --system-- ----cpu----\n");
+  printf(
+    "%2s %2s %6s %6s %6s %6s %4s %4s %5s %5s %4s %5s %2s %2s %2s %2s\n",
+    "b","w",
+    "swpd", "free", a_option?"inact":"buff", a_option?"active":"cache",
+    "si","so",
+    "bi","bo",
+    "in","cs",
+    "us","sy","id","wa"
+  );
 }
 
 static void new_format(void) {
@@ -353,7 +354,7 @@ static void new_format(void) {
   int debt = 0;  // handle idle ticks running backwards
 
   sleep_half=(sleep_time/2);
-  old_header();
+  new_header();
 
   getrunners(&running,&blocked,&r_swapp,&d_swapp);
   meminfo();
@@ -385,7 +386,7 @@ static void new_format(void) {
 
   for(i=1;i<num_updates;i++) { /* \\\\\\\\\\\\\\\\\\\\ main loop ////////////////// */
     sleep(sleep_time);
-    if (moreheaders && ((i%height)==0)) old_header();
+    if (moreheaders && ((i%height)==0)) new_header();
     tog= !tog;
 
     getrunners(&running,&blocked,&r_swapp,&d_swapp);
@@ -487,7 +488,7 @@ int main(int argc, char *argv[]) {
 
   setlinebuf(stdout);
 
-  old_format();
+  new_format();
   return 0;
 }