* wrong unit for TIMEFMT=%M
@ 2020-02-24 19:40 Stephane Chazelas
0 siblings, 0 replies; only message in thread
From: Stephane Chazelas @ 2020-02-24 19:40 UTC (permalink / raw)
To: Zsh hackers list
TIMEFMT=%M is meant to report memory usage in KiB, but it's not the
case in Linux and FreeBSD at least.
It seems like zsh's TIMEFMT has had a tormented history.
For %M,
2.00.03 had
case 'M': fprintf(stderr,"%ld",ru->ru_maxrss); break
In 2.2, that changed to
#if sun
case 'M': fprintf(stderr,"%ld",ru->ru_maxrss*pk); break;
#else
fprintf(stderr, "%ld", ru->ru_maxrss / 1024);
#endif
(pk being the number of KiB per page).
It seemed to disappear altogether in 2.6 and came back circa
4.0.4 as
fprintf(stderr, "%ld", ru->ru_maxrss / 1024);
GNU time's configure.ac has:
# What memory units are reported by getrusage(2) ?
warn_getrusage_mem_units=
if test -z "$time_getrusage_mem_units" ; then
# if envvar 'time_getrusage_mem_units' isn't set,
# autodetect based on OS.
case "$host_os" in
minix*|aix*|*bsd*|linux*|gnu*)
time_getrusage_mem_units=kb ;;
macos*|darwin*) time_getrusage_mem_units=bytes ;;
solaris*) time_getrusage_mem_units=pages ;;
# As a fallback, assume KB (the most common value).
# Set the 'warn' variable to warn the user at the end
# of ./configure
*) time_getrusage_mem_units=kb
warn_getrusage_mem_units=yes
;;
esac
fi
Suggesting zsh is only correct on macos/darwin atm.
--
Stephane
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2020-02-24 19:41 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-24 19:40 wrong unit for TIMEFMT=%M Stephane Chazelas
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).