rpms/procps/F-10 procps-3.2.7-vmstat-timestamp-manpage.patch, NONE, 1.1 procps-3.2.7-vmstat-timestamp.patch, NONE, 1.1 procps.spec, 1.73, 1.74

Daniel Novotny dnovotny at fedoraproject.org
Tue Feb 3 12:26:15 UTC 2009


Author: dnovotny

Update of /cvs/extras/rpms/procps/F-10
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv29174

Modified Files:
	procps.spec 
Added Files:
	procps-3.2.7-vmstat-timestamp-manpage.patch 
	procps-3.2.7-vmstat-timestamp.patch 
Log Message:

fix #476134


procps-3.2.7-vmstat-timestamp-manpage.patch:

--- NEW FILE procps-3.2.7-vmstat-timestamp-manpage.patch ---
diff -up procps-3.2.7/vmstat.8.timestamp procps-3.2.7/vmstat.8
--- procps-3.2.7/vmstat.8.timestamp	2009-02-03 12:32:27.000000000 +0100
+++ procps-3.2.7/vmstat.8	2009-02-03 12:34:37.000000000 +0100
@@ -8,6 +8,7 @@ vmstat \- Report virtual memory statisti
 .B vmstat
 .RB [ "\-a" ]
 .RB [ "\-n" ]
+.RB [ "\-t" ]
 .RI [ delay " [ " count ]]
 .br
 .B vmstat
@@ -43,7 +44,9 @@ equivalent to the total number of tasks 
 is represented by one or more tasks, depending on thread usage.
 This display does not repeat.
 .PP
-The \fB-m\fP displays slabinfo.
+The \fB-t\fP switch adds timestamp to the output.
+.PP
+The \fB-m\fP switch displays slabinfo.
 .PP
 The \fB-n\fP switch causes the header to be displayed only once rather than periodically.
 .PP

procps-3.2.7-vmstat-timestamp.patch:

--- NEW FILE procps-3.2.7-vmstat-timestamp.patch ---
--- procps-3.2.7/vmstat.c	2008-12-11 22:11:30.042532106 -0500
+++ procps-3.2.7/vmstat.c.timestamp	2008-12-11 22:08:11.553529883 -0500
@@ -25,6 +25,7 @@
 #include <sys/ioctl.h>
 #include <sys/dir.h>
 #include <dirent.h>
+#include <time.h>
 
 #include "proc/sysinfo.h"
 #include "proc/version.h"
@@ -56,6 +57,7 @@
 
 static unsigned int height;   // window height
 static unsigned int moreheaders=TRUE;
+static unsigned int showtimestamp=FALSE;
 
 
 /////////////////////////////////////////////////////////////////////////
@@ -71,6 +73,7 @@
   fprintf(stderr,"              -p prints disk partition statistics\n");
   fprintf(stderr,"              -s prints vm table\n");
   fprintf(stderr,"              -m prints slabinfo\n");
+  fprintf(stderr,"              -t add timestamp to output\n");
   fprintf(stderr,"              -S unit size\n");
   fprintf(stderr,"              delay is the delay between updates in seconds. \n");
   fprintf(stderr,"              unit size k:1000 K:1024 m:1000000 M:1048576 (default is K)\n");
@@ -150,7 +153,11 @@
 ////////////////////////////////////////////////////////////////////////////
 
 static void new_header(void){
-  printf("procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu------\n");
+  if(!showtimestamp){
+     printf("procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu------\n");
+  } else {
+     printf("procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu------ ---timestamp---\n");
+  }
   printf(
     "%2s %2s %6s %6s %6s %6s %4s %4s %5s %5s %4s %4s %2s %2s %2s %2s %2s\n",
     "r","b",
@@ -173,7 +180,7 @@
 ////////////////////////////////////////////////////////////////////////////
 
 static void new_format(void) {
-  const char format[]="%2u %2u %6lu %6lu %6lu %6lu %4u %4u %5u %5u %4u %4u %2u %2u %2u %2u %2u\n";
+  const char format[]="%2u %2u %6lu %6lu %6lu %6lu %4u %4u %5u %5u %4u %4u %2u %2u %2u %2u %2u\t%s\n";
   unsigned int tog=0; /* toggle switch for cleaner code */
   unsigned int i;
   unsigned int hz = Hertz;
@@ -185,6 +192,10 @@
   unsigned int sleep_half; 
   unsigned long kb_per_page = sysconf(_SC_PAGESIZE) / 1024ul;
   int debt = 0;  // handle idle ticks running backwards
+  struct tm *tm_ptr;
+  time_t the_time;
+  char timebuf[32];
+  timebuf[0] = '\0';
 
   sleep_half=(sleep_time/2);
   new_header();
@@ -196,6 +207,13 @@
 	  &running,&blocked,
 	  &dummy_1, &dummy_2);
 
+  if (showtimestamp)
+  {
+     (void) time( &the_time );
+     tm_ptr = localtime( &the_time );
+     strftime(timebuf, sizeof(timebuf), "%Y-%m-%d %H:%M:%S %Z", tm_ptr);
+  }
+
   duse= *cpu_use + *cpu_nic; 
   dsys= *cpu_sys + *cpu_xxx + *cpu_yyy;
   didl= *cpu_idl;
@@ -218,7 +236,8 @@
 	 (unsigned)( (100*dsys                    + divo2) / Div ),
 	 (unsigned)( (100*didl                    + divo2) / Div ),
 	 (unsigned)( (100*diow                    + divo2) / Div ),
-	 (unsigned)( (100*dstl                    + divo2) / Div )
+	 (unsigned)( (100*dstl                    + divo2) / Div ),
+	 timebuf
   );
 
   for(i=1;i<num_updates;i++) { /* \\\\\\\\\\\\\\\\\\\\ main loop ////////////////// */
@@ -234,6 +253,13 @@
 	  &running,&blocked,
 	  &dummy_1,&dummy_2);
 
+    if (showtimestamp)
+    {
+       (void) time( &the_time );
+       tm_ptr = localtime( &the_time );
+       strftime(timebuf, sizeof(timebuf), "%Y-%m-%d %H:%M:%S %Z", tm_ptr);
+    }
+
     duse= cpu_use[tog]-cpu_use[!tog] + cpu_nic[tog]-cpu_nic[!tog];
     dsys= cpu_sys[tog]-cpu_sys[!tog] + cpu_xxx[tog]-cpu_xxx[!tog] + cpu_yyy[tog]-cpu_yyy[!tog];
     didl= cpu_idl[tog]-cpu_idl[!tog];
@@ -267,7 +293,8 @@
 	   (unsigned)( (100*dsys+divo2)/Div ), /*sy*/
 	   (unsigned)( (100*didl+divo2)/Div ), /*id*/
 	   (unsigned)( (100*diow+divo2)/Div ), //wa
-	   (unsigned)( (100*dstl+divo2)/Div )  //st
+	   (unsigned)( (100*dstl+divo2)/Div ), //st
+	   timebuf /* timestamp */
     );
   }
 }
@@ -641,6 +668,9 @@
       case 's':
         statMode |= VMSUMSTAT; 	
 	break;
+      case 't':
+        showtimestamp=TRUE;
+        break;
       default:
 	/* no other aguments defined yet. */
 	usage();


Index: procps.spec
===================================================================
RCS file: /cvs/extras/rpms/procps/F-10/procps.spec,v
retrieving revision 1.73
retrieving revision 1.74
diff -u -r1.73 -r1.74
--- procps.spec	1 Sep 2008 09:59:00 -0000	1.73
+++ procps.spec	3 Feb 2009 12:25:44 -0000	1.74
@@ -1,7 +1,7 @@
 Summary: System and process monitoring utilities
 Name: procps
 Version: 3.2.7
-Release: 21%{?dist}
+Release: 22%{?dist}
 License: GPLv2+ and LGPLv2+
 Group: Applications/System
 URL: http://procps.sourceforge.net
@@ -72,6 +72,10 @@
 Patch34: procps-3.2.7-top-clrscr.patch
 #435453 - errors with man -t formatting of ps man page
 Patch35: procps-3.2.7-ps-man-fmt.patch
+#476134 - added timestamp to vmstat with new option -t
+Patch36: procps-3.2.7-vmstat-timestamp.patch
+#manual page updated to document the -t functionality
+Patch37: procps-3.2.7-vmstat-timestamp-manpage.patch
 
 BuildRequires: ncurses-devel
 
@@ -132,6 +136,8 @@
 %patch33 -p1
 %patch34 -p1
 %patch35 -p1
+%patch36 -p1
+%patch37 -p1
 
 cp %SOURCE1 .
 
@@ -169,6 +175,9 @@
 %attr(0644,root,root) %{_mandir}/man5/*
 
 %changelog
+*Tue Feb 03 2009 Daniel Novotny <dnovotny at redhat.com> 3.2.7-22
+- added timestamp to vmstat with new option -t (#476134)
+
 * Mon Sep 01 2008 Tomas Smetana <tsmetana at redhat.com> 3.2.7-21
 - rebase patches
 - clear screen in top when switching windows




More information about the fedora-extras-commits mailing list