Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
[bug] TIMEFMT=%M reports value in mebibyte, not kibibytes
- X-seq: zsh-workers 49086
- From: Stephane Chazelas <stephane@xxxxxxxxxxxx>
- To: Zsh hackers list <zsh-workers@xxxxxxx>
- Subject: [bug] TIMEFMT=%M reports value in mebibyte, not kibibytes
- Date: Fri, 18 Jun 2021 20:48:48 +0100
- Archived-at: <https://zsh.org/workers/49086>
- List-id: <zsh-workers.zsh.org>
- Mail-followup-to: Zsh hackers list <zsh-workers@xxxxxxx>
Documentation says:
%M
The maximum memory the process had in use at any time in
kilobytes.
However the code has:
#ifdef HAVE_STRUCT_RUSAGE_RU_MAXRSS
case 'M':
fprintf(stderr, "%ld", ti->ru_maxrss / 1024);
break;
#endif
And at least on Linux and FreeBSD, ru_maxrss is already in kibibytes (though
doc says kilobytes), not bytes.
So we end up with a value in mebibytes:
$ zsh -c 'command time -f %M uname; TIMEFMT=%M; time uname'
Linux
1620
Linux
1
Same happens for REPORTMEMORY handling.
I have the feeling it's been discussed before (or maybe there's
something similar going on with rlimits). It could very well be
that there are some systems where ru_maxrss is in bytes.
--
Stephane
Messages sorted by:
Reverse Date,
Date,
Thread,
Author