Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
wrong unit for TIMEFMT=%M
- X-seq: zsh-workers 45489
- From: Stephane Chazelas <stephane@xxxxxxxxxxxx>
- To: Zsh hackers list <zsh-workers@xxxxxxx>
- Subject: wrong unit for TIMEFMT=%M
- Date: Mon, 24 Feb 2020 19:40:21 +0000
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- List-unsubscribe: <mailto:zsh-workers-unsubscribe@zsh.org>
- Mail-followup-to: Zsh hackers list <zsh-workers@xxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author