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

[bug] TIMEFMT=%M reports value in mebibyte, not kibibytes



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