Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Documentation of the TIMEFMT variable



Stephane Chazelas wrote on Fri, Feb 03, 2023 at 20:52:44 +0000:
> 2023-02-02 11:33:56 -0800, Bart Schaefer:
> > On Thu, Feb 2, 2023 at 8:54 AM trillian
> > <just.so.you.can.email.me@xxxxxxxxx> wrote:
> > >
> > > The documentation of TIMEFMT says that %M means "The  maximum memory the
> > > process had in use at any time in kilobytes", but the actual value shown
> > > is in megabytes. (The kernel reports it in kilobytes and zsh divides it
> > > by 1024 again.)
> > 
> > This has been reported twice before, although after looking at the
> > previous two reports I'm not sure if this is a documentation error or
> > a coding error or (OS-dependently) both.  Anyone?
> 
> A portability issue. Doc is correct, but code is only correct on
> Darwin/macos. GNU time's autoconf has some info on the subject
> IIRC.
> 
> It's been reported many times here. See workers/45489,
> workers/42363, workers/30399, workers/49145.
> 
> macos/darwin is the odd one out. ru_maxrss was already in
> kibibytes in the original getrusage() implementation in BSD4.2
> in 1985.

Another consideration: the doc states that %X and %D are also given
in KB.  Assuming that for these two the implementation does in fact
match the docs, changing the implementation of %M to match the docs
would result in %M/%X/%D all expanding to values in KB, which seems
preferable to having some of them expand to values in KB and some to
values in MB.

Cheers,

Daniel




Messages sorted by: Reverse Date, Date, Thread, Author