1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-11-11 09:40:59 +01:00

51604: %M in TIMEFMT should report in kilobytes

This commit is contained in:
Jun-ichi Takimoto 2023-03-30 14:58:07 +09:00
parent 12e5db145b
commit c006d76097
3 changed files with 21 additions and 7 deletions

View file

@ -1,3 +1,8 @@
2023-03-30 Jun-ichi Takimoto <takimoto-j@kba.biglobe.ne.jp>
* 51604: Src/jobs.c, configure.ac: %M in TIMEFMT should report
in kilobytes
2023-03-28 Mikael Magnusson <mikachu@gmail.com>
* 51602: Src/jobs.c, Src/signames2.awk: Handle SIGIOT as an

View file

@ -888,8 +888,13 @@ printtime(struct timeval *real, child_times_t *ti, char *desc)
break;
#endif
#ifdef HAVE_STRUCT_RUSAGE_RU_MAXRSS
#ifdef RU_MAXRSS_IS_IN_BYTES
# define MAXRSS_IN_KB(x) ((x)/1024)
#else
# define MAXRSS_IN_KB(x) (x)
#endif
case 'M':
fprintf(stderr, "%ld", ti->ru_maxrss / 1024);
fprintf(stderr, "%ld", MAXRSS_IN_KB(ti->ru_maxrss));
break;
#endif
#ifdef HAVE_STRUCT_RUSAGE_RU_MAJFLT
@ -1036,7 +1041,7 @@ should_report_time(Job j)
#ifdef HAVE_GETRUSAGE
if (reportmemory >= 0 &&
j->procs->ti.ru_maxrss / 1024 > reportmemory)
MAXRSS_IN_KB(j->procs->ti.ru_maxrss) > reportmemory)
return 1;
#endif
@ -2646,11 +2651,6 @@ static const struct {
{ "IO", SIGIO },
#endif
#endif
#if defined(SIGABRT) && defined(SIGIOT)
#if SIGABRT == SIGIOT
{ "IOT", SIGIOT },
#endif
#endif
#if !defined(SIGERR)
/*
* If SIGERR is not defined by the operating system, use it

View file

@ -1965,6 +1965,15 @@ if test x$ac_cv_func_getrusage = xyes; then
#endif
#include <sys/resource.h>])
fi
dnl On some OSes (only macOS?) ru_maxrss is in bytes (not in kilobytes).
dnl Solaris uses pages as the unit, but ru_maxrss is set to zero anyway.
AH_TEMPLATE(RU_MAXRSS_IS_IN_BYTES,
[Define to 1 if ru_maxrss in struct rusage is in bytes.])
case "$host_os" in
darwin*)
AC_DEFINE(RU_MAXRSS_IS_IN_BYTES)
;;
esac
dnl --------------------------------------------