bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: bug in gnu time 1.7


From: Mark Visser
Subject: Re: bug in gnu time 1.7
Date: Wed, 27 Nov 2013 13:38:31 -0500

Good question. I did some digging, and ru_idrss, ru_isrss and ru_ixrss are
unused on Linux -- from
http://man7.org/linux/man-pages/man2/getrusage.2.html:

       *ru_maxrss* (since Linux 2.6.32)
              This is the maximum resident set size used (in kilobytes).
              For *RUSAGE_CHILDREN*, this is the resident set size of the
              largest child, not the maximum resident set size of the
              process tree.

       *ru_ixrss* (unmaintained)
              This field is currently unused on Linux.

       *ru_idrss* (unmaintained)
              This field is currently unused on Linux.

       *ru_isrss* (unmaintained)

              This field is currently unused on Linux.

But GNU libc implies they are all in kilobytes
http://www.gnu.org/software/libc/manual/html_node/Resource-Usage.html:

long int ru_maxrssThe maximum resident set size used, in kilobytes. That
is, the maximum number of kilobytes of physical memory that processes used
simultaneously.
long int ru_ixrssAn integral value expressed in kilobytes times ticks of
execution, which indicates the amount of memory used by text that was
shared with other processes.
long int ru_idrssAn integral value expressed the same way, which is the
amount of unshared memory used for data.
long int ru_isrssAn integral value expressed the same way, which is the
amount of unshared memory used for stack space.

BSD explicitly states they are in kilobytes
http://www.manpages.info/freebsd/getrusage.2.html:

        *ru_maxrss*       the maximum resident set size utilized (in kilobytes).

     *ru_ixrss*   an ``integral'' value indicating the amount of memory used
                  by the text segment that was also shared among other pro-
                  cesses.  This value is expressed in units of kilobytes *
                  ticks-of-execution.  Ticks are statistics clock ticks.  The
                  statistics clock has a frequency of *sysconf*(*_SC_CLOCK_TCK*)
                  ticks per second.

     *ru_idrss*   an integral value of the amount of unshared memory residing
                  in the data segment of a process (expressed in units of
                  kilobytes * ticks-of-execution).

     *ru_isrss*   an integral value of the amount of unshared memory residing
                  in the stack segment of a process (expressed in units of
kilobytes * ticks-of-execution).


Except, of course, for Darwin, which uses bytes for all four of these
fields http://lists.apple.com/archives/darwin-kernel/2009/Mar/msg00005.html.

So a unit of pages is definitely wrong for all four fields, but what is
right depends on the target OS.

cheers,
-Mark


On Wed, Nov 27, 2013 at 12:45 PM, Andreas Schwab <address@hidden>wrote:

> Mark Visser <address@hidden> writes:
>
> > 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);
>
> What about the other uses of ptok?
>
> Andreas.
>
> --
> Andreas Schwab, address@hidden
> GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
> "And now for something completely different."
>


reply via email to

[Prev in Thread] Current Thread [Next in Thread]