Bug 723164

Summary: vmstat -t option does not work
Product: [Fedora] Fedora Reporter: Shane Kerr <shane>
Component: procpsAssignee: Jaromír Cápík <jcapik>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 15CC: fedora, jcapik, ovasik, steppnav
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: procps-3.2.8-22.20110302git.fc15 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-11-13 05:34:19 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Attachments:
Description Flags
Fixed version of the timestamp patch none

Description Shane Kerr 2011-07-19 09:35:35 UTC
User-Agent:       Mozilla/5.0 (X11; Linux x86_64; rv:5.0) Gecko/20100101 Firefox/5.0

Both the man page and the help from the vmstat command document the "-t" option, as one which adds timestamp to the output:

$ man vmstat
 ...
SYNOPSIS
       vmstat [-a] [-n] [-t] [delay [ count]]
 ...
       The -t switch adds timestamp to the output.

However as far as I can tell there is no way to get this to work.

I had a look at the source RPM and it looks like this is supposed to be enabled via the procps-3.2.7-vmstat-timestamp.patch file, however this does not modify the arguments to getopt(), so this would never work. This should be a simple, 1-character fix to vmstat.c in the main() function:

  while((c = getopt(argc, argv, "VdafmDnp:S:st")) != EOF) switch(c) {

I went ahead and tested this - it seems to work fine. I'll attached a replacement for the procps-3.2.7-vmstat-timestamp.patch with this minor change which could be used instead.

(I know I should stick to the issue in the bug report, but shouldn't these patches be pushed upstream, or maybe fork the project if it is quiescent?)

Reproducible: Always

Steps to Reproduce:
1. vmstat -t 1

Actual Results:  
/usr/bin/vmstat: invalid option -- 't'


Expected Results:  
procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu------ ---timestamp---
 r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa st
 1  0      0 2509064 346936 2664124    0    0    64    55  850  735  7  3 90  0  0	2011-07-19 11:35:01 CEST

Comment 1 Shane Kerr 2011-07-19 09:37:46 UTC
Created attachment 513748 [details]
Fixed version of the timestamp patch

Comment 2 Charles Stepp 2011-10-13 15:21:06 UTC
Looking for some cross *nix simplicity. putting the -t timestamp on vmstat should be done for those of us who collect somewhat cross platform with those simple old tools.

Comment 3 Jaromír Cápík 2011-10-27 15:19:17 UTC
Hello Shane.

I'm just rebuilding procps in f15, f16 and rawhide with the proposed change.
The fix should be available next week.

Thank You.

Regards,
Jaromir.

Comment 4 Fedora Update System 2011-10-27 15:50:44 UTC
procps-3.2.8-22.20110302git.fc15 has been submitted as an update for Fedora 15.
https://admin.fedoraproject.org/updates/procps-3.2.8-22.20110302git.fc15

Comment 5 Fedora Update System 2011-10-27 15:53:42 UTC
procps-3.2.8-24.20110302git.fc16 has been submitted as an update for Fedora 16.
https://admin.fedoraproject.org/updates/procps-3.2.8-24.20110302git.fc16

Comment 6 Fedora Update System 2011-10-30 00:32:06 UTC
Package procps-3.2.8-22.20110302git.fc15:
* should fix your issue,
* was pushed to the Fedora 15 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing procps-3.2.8-22.20110302git.fc15'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2011-15092
then log in and leave karma (feedback).

Comment 7 Fedora Update System 2011-11-05 01:23:01 UTC
procps-3.2.8-24.20110302git.fc16 has been pushed to the Fedora 16 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 8 Fedora Update System 2011-11-13 05:34:19 UTC
procps-3.2.8-22.20110302git.fc15 has been pushed to the Fedora 15 stable repository.  If problems still persist, please make note of it in this bug report.