[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Bug-time] GNU time reports incorrect maximum RSS
From: |
Assaf Gordon |
Subject: |
Re: [Bug-time] GNU time reports incorrect maximum RSS |
Date: |
Sun, 23 Dec 2018 15:31:10 -0700 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.3.0 |
Hello,
On 2018-12-23 6:58 a.m., Donald Buczek wrote:
we just learned the hard way about a bug in gnu time, that the maximum
resident set size reported is scaled up by a factor 4, because the
corresponding field the the rusage struct is wrongly interpreted as
pages instead of kilobyte and scaled up on output.
This bug is 8 years old, and usually fixed by the distros, so
distro-users don't see it. It has never been fixed in upstream, however.
[1] [2]
OlderGNU Time has not been updated for a long time (excuse the pun).
Version 1.7 was released in 1996 (!), more than 20 years ago.
In that version, the kernel interface reported pages, and that's
what was reported by "time".
As you correctly noticed, every GNU/Linux distribution that packaged
time had their own version of a patch to fix this issue.
The bug still exists in the master branch.
That is not accurate.
In 2017 maintenance of GNU time was resumed,
and many of the downstream patches have been incorporated upstream:
https://git.savannah.gnu.org/cgit/time.git/log/
$ curl -so mem.cpp https://ideone.com/plain/5bsp0R && make mem &&
/usr/bin/time -f "time thinks my peak rss is %M kB" ./mem
g++ mem.cpp -o mem
procfs thinks my peak RSS is: 514652 kB
time thinks my peak rss is 2058608 kB
In the above example, you are likely using version 1.7.
Please try again with the latest version 1.9 (released in March 2018),
available here: https://ftp.gnu.org/gnu/time/ .
$ curl -so mem.cpp https://ideone.com/plain/5bsp0R
$ g++ mem.cpp -o mem
$ ./time --version | head -n1
time (GNU Time) 1.9
$ ./time -f "time thinks my peak rss is %M kB" ./mem
procfs thinks my peak RSS is: 514324 kB
time thinks my peak rss is 514324 kB
If you still experience wrong results with the latest version,
please do report them.
regards,
- assaf