bug-time
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug-time] GNU time reports incorrect maximum RSS


From: Donald Buczek
Subject: [Bug-time] GNU time reports incorrect maximum RSS
Date: Sun, 23 Dec 2018 14:58:05 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1

Hello,

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]

The bug still exists in the master branch.

    $ 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

The patch from [1] fixes the problem:

    address@hidden:~/time-rss$ /usr/bin/time -f "time thinks my peak rss is %M 
kB" ./mem
    procfs thinks my peak RSS is:       514616 kB
    time thinks my peak rss is 514616 kB

Thanks

  Donald

[1] https://bugzilla.redhat.com/show_bug.cgi?id=702826
[2] https://groups.google.com/forum/#!topic/gnu.utils.help/u1MOsHL4bhg


--
Donald Buczek
address@hidden
Tel: +49 30 8413 1433



reply via email to

[Prev in Thread] Current Thread [Next in Thread]