bug in gnu time 1.7

Mark Visser <[email protected]>
Newsgroups gmane.comp.gnu.utils.bugs
Message-ID <CAGPkt36F=yNWSC2DiH+XzvmLZMoBK18fDinXMs9fx_HDXDfJ=g@mail.gmail.com>
max rss is reported to be 4 times larger than it actually is:

http://stackoverflow.com/questions/10035232/maximum-resident-set-size-does-not-make-sense

original bug report:

https://groups.google.com/forum/#!topic/gnu.utils.help/u1MOsHL4bhg

patch:

diff -ru time-1.7.orig/ChangeLog time-1.7/ChangeLog
--- time-1.7.orig/ChangeLog        1996-07-11 10:37:20.000000000 -0600
+++ time-1.7/ChangeLog        2010-10-01 16:03:09.000000000 -0600
@@ -1,3 +1,10 @@
+2010-10-01  Bob Proulx  <[email protected]>
+
+        The struct rusage reports ru_maxrss in kbytes not pages and
+        should not be converted through pages-to-kbytes again.
+        Reported by Sven Hartrumpf.
+        * time.c (summarize): Do not call ptok on ru_maxrss.
+
diff -ru time-1.7.orig/time.c time-1.7/time.c
--- time-1.7.orig/time.c        1996-06-13 13:38:21.000000000 -0600
+++ time-1.7/time.c        2010-10-01 15:49:11.000000000 -0600
@@ -392,7 +392,7 @@
                        ptok ((UL) resp->ru.ru_ixrss) / MSEC_TO_TICKS (v));
               break;
             case 'M':                /* Maximum resident set size.  */
-              fprintf (fp, "%lu", ptok ((UL) resp->ru.ru_maxrss));
+              fprintf (fp, "%lu", (UL) resp->ru.ru_maxrss);
               break;
             case 'O':                /* Outputs.  */
               fprintf (fp, "%ld", resp->ru.ru_oublock);
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.