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

Re: time builtin vs. time(1): difference in memory numbers



Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> writes:

> On Dec 4,  4:43am, Anonymous wrote:
> } Subject: time builtin vs. time(1): difference in memory numbers
> }
> } zsh-4.3.10_4, FreeBSD 9.0-CURRENT r216095M amd64
> } 
> } I'm a bit puzzled by...
> } 
> } - numbers for shared/unshared space don't match those from `time -l'
>
> Zsh's %X and %D compute the average amount of shared/unshared space by
> using the ru_ixrss and (ru_idrss + ru_isrss) values from rusage,
> respectively, as the numerator, and (ru_utime + ru_stime) as the
> denominator.  I don't know what the BSD time command uses for the
> denominator.

According to getrusage(2) on BSDs ixrss/idrss/isrss are "expressed in
units of kilobytes * ticks-of-execution". So, I've made a quick hack

  http://www.freebsd.org/cgi/query-pr.cgi?pr=ports/152820

a bit different from time(1) that uses stathz from kern.clockrate sysctl.

> Zsh also rounds down microseconds to perform all of its
> computations in seconds, which may lead to differences.
>
> } - zsh manual page claims that %M stands for memory in Kbytes while it
> }   displays them in Mbytes
>
> Hm.  %M stands for ru_maxrss / 1024.  Zsh would only be displaying
> that in Mbytes if ru_maxrss is expressed in Gbytes internally.  Has
> FreeBSD changed the base units of maxrss in rusage?

maxrss like ixrss/idrss/isrss is expressed "in kilobytes"

  http://man.freebsd.org/getrusage/2



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