|
|
>> 0:15.27 wall time, 89% CPU, 1608592 KB maximum
>>
>> The program *actually* used about 400MB of RAM. So WTF is %M actually
>> measuring? Because it sure as hell isn't "maximum resident set size of
>> the process during its lifetime, measured in Kilobytes".
>
> But there is more than 400MB of data in the RSS.
> First, you have the program itself (what is the filesize ?)
> Next, all the shared libraries (and their cascades).
> And if 400MB is your malloc... there is also the function's stack to
> allocate: calling a function with an array or a structure in C++ is
> allowed, and if you do not push for a reference, you might get the value
> copied on the stack...
>
> Recursion in functions is another deepener.
I ran an interactive resource monitor while the program was running, and
saw that free memory decreased by 400MB while the program was running.
That's how I know it used roughly 400MB. (I don't know what it used it
*for*, but I would presume mostly heap space.)
If the figure reported ("1608592") really is in KB, that's 1.6GB - which
far exceeds the available physical memory. That can't be right.
If the figure is actually bytes, then that's 1.6MB - which is *still* wrong.
>> (Also, why do %D, %K and %X all return 0 for every program?)
>
> 15 seconds is a very short time.
It's several eternities for a computer.
> Also, even if supported on the command line, the man page states:
> "Not all resources are measured
> by all versions of Unix, so some of the values might be reported
> as zero. "
Right. So Linux doesn't suppose this information. That's OK.
>> More generally, how do I make time tell me HOW MUCH RAM WAS USED?
>
> What is RAM used for ?
> RSS is the answer, for program, lib& data.
Then why do the answers not match reality?
>> Is there any way of automating this absurd tedium?
>
> Yes.
> Use the target naming in your makefile's rules
> (have a search about $* $< $> ... in make tutorial)
I don't particularly want to spend three weeks reading through the
obtuse reference manual. It would be quicker to just keep typing this
stuff by hand. I just wondered whether somebody already happens to know
the answer to this (presumably) very common problem...
Post a reply to this message
|
|