/usr/bin/time and memory usage

  • Follow


hello all,

I am trying to get memory usage stats out of /usr/bin/time, but it really 
seems it is always reported as zero.

it is not a problem of the OS (kernel 2.4.7-10), since I can look under 
/proc/<PID>/status and find the information.

Unfortunately, since I need to run hunderds of thousands of tests, I cannot 
use that directory, which is destroyed when the process ends. It really 
looks like "time" has a bug.

any ideas?

thanks,
Claudio

-- 
La costruzione del mio amore
mi piace guardarla salire
come un grattacielo di cento piani
o come un girasole.

(Ivano Fossati)
0
Reply claudio.TOGLIMI.castellini (2) 6/21/2004 3:10:22 PM

On Mon, 21 Jun 2004 17:10:22 +0200, Claudio Castellini staggered into
the Black Sun and said:
> I am trying to get memory usage stats out of /usr/bin/time

The man page for time(1) on my system doesn't say anything at all about
memory usage stats for the process that's being timed.  Just timing
stats.  Where did you hear that time(1) would provide memory usage
stats?

> it is not a problem of the OS (kernel 2.4.7-10), since I can look
> under /proc/<PID>/status and find the information.

Time to update that kernel; there were problems with the 2.4 series's
swap and memory handling up til 2.4.10.

> Unfortunately, since I need to run hunderds of thousands of tests, I
> cannot use that directory, which is destroyed when the process ends.

Get the PID of the process you're timing, poll the directory in /proc
every second while it exists, write the info to a file?

-- 
Matt G|There is no Darkness in Eternity/But only Light too dim for us to see
Brainbench MVP for Linux Admin /    mail: TRAP + SPAN don't belong
http://www.brainbench.com     /                Hire me! 
-----------------------------/ http://crow202.dyndns.org/~mhgraham/resume
0
Reply danSPANceswitTRAPhcrows2 (768) 6/21/2004 4:01:37 PM


Dances With Crows wrote:
>>I am trying to get memory usage stats out of /usr/bin/time
> The man page for time(1) on my system doesn't say anything at all about
> memory usage stats for the process that's being timed.  Just timing
> stats.  Where did you hear that time(1) would provide memory usage
> stats?

On my system, I get full capabilities. For instance, %K in the format 
string will report (according to man time) "Average total (data+stack+text) 
memory use of the process, in Kbytes." which would be just fine... but it 
does not. It just reports zero, whatever I do.

(are you looking at the bash internal command's man, rather than 
/usr/bin/time...?)


>>it is not a problem of the OS (kernel 2.4.7-10), since I can look
>>under /proc/<PID>/status and find the information.
> Time to update that kernel; there were problems with the 2.4 series's
> swap and memory handling up til 2.4.10.

unfortunately I am no root on this machine. The update process is decided, 
if it is, intranet-wide.


>>Unfortunately, since I need to run hunderds of thousands of tests, I
>>cannot use that directory, which is destroyed when the process ends.
> Get the PID of the process you're timing, poll the directory in /proc
> every second while it exists, write the info to a file?

yes, this is a possibility. But getting /usr/bin/time to work would be 
simpler and probably better...

thank you anyway
c.

-- 
La costruzione del mio amore
mi piace guardarla salire
come un grattacielo di cento piani
o come un girasole.

(Ivano Fossati)
0
Reply claudio.TOGLIMI.castellini (2) 6/21/2004 4:14:29 PM

On Mon, 21 Jun 2004 18:14:29 +0200, Claudio Castellini staggered into
the Black Sun and said:
> Dances With Crows wrote:
>>>I am trying to get memory usage stats out of /usr/bin/time
>> The man page for time(1) on my system doesn't say anything at all
>> about memory usage stats for the process that's being timed.
> (are you looking at the bash internal command's man, rather than
> /usr/bin/time...?)

Yes, I was.  /usr/bin/time wasn't installed... fixed that with "emerge
sys-apps/time" and I see what you saw.

> On my system, I get full capabilities. For instance, %K in the format
> string will report (according to man time) "Average total
> (data+stack+text) memory use of the process, in Kbytes." which would
> be just fine... but it does not. It just reports zero, whatever I do.

I looked at the source for /usr/bin/time and found that the memory usage
stats are only filled in for certain OSes.  Linux isn't one of those
OSes, since /usr/include/sys/rusage.h isn't present on Linux.

>>>it is not a problem of the OS (kernel 2.4.7-10), since I can look
>> Time to update that kernel; there were problems with the 2.4 series's
>> swap and memory handling up til 2.4.10.
> unfortunately I am no root on this machine. The update process is
> decided, if it is, intranet-wide.

ping your sysadmin about this, then.  The performance improvements I saw
when I updated to 2.4.10 a year or so back were substantial.  You also
might want to mention the fact that any user can crash the system on an
old kernel by compiling and running a small C program...
http://slashdot.org/article.pl?sid=04/06/14/118209&tid=128 among other
places where this kernel bug was mentioned.

>> Get the PID of the process you're timing, poll the directory in /proc
>> every second while it exists, write the info to a file?
> yes, this is a possibility. But getting /usr/bin/time to work would be
> simpler and probably better...

I don't think so, now that I've had a look at the source of time.  You'd
have to figure out some sort of hack to get the rusage stats, which
would certainly involve modifying time's source.  Oh well, whatever you
think....

-- 
Matt G|There is no Darkness in Eternity/But only Light too dim for us to see
Brainbench MVP for Linux Admin /    mail: TRAP + SPAN don't belong
http://www.brainbench.com     /                Hire me! 
-----------------------------/ http://crow202.dyndns.org/~mhgraham/resume
0
Reply danSPANceswitTRAPhcrows2 (768) 6/21/2004 7:09:54 PM

3 Replies
83 Views

(page loaded in 0.071 seconds)

Similiar Articles:













7/14/2012 7:19:55 AM


Reply: