LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 01-03-2009, 12:29 PM   #1
skyrenderx
LQ Newbie
 
Registered: Jan 2009
Posts: 3

Rep: Reputation: 0
My "time" command is broken!


I'm trying to measure the maximum memory used by a process. This is a process which I know to be very memory intensive. However, "time" always reports the memory usage as ZERO. Using "time" with other commands yields the same result. An example is listed below.

Why would this be? Why can't I measure the memory usage?

me@eon $ /usr/bin/time -v date
Sat Jan 3 10:03:10 PST 2009
Command being timed: "date"
User time (seconds): 0.00
System time (seconds): 0.00
Percent of CPU this job got: 0%
Elapsed (wall clock) time (h:mm:ss or m:ss): 0:00.01
Average shared text size (kbytes): 0
Average unshared data size (kbytes): 0
Average stack size (kbytes): 0
Average total size (kbytes): 0
Maximum resident set size (kbytes): 0
Average resident set size (kbytes): 0
Major (requiring I/O) page faults: 0
Minor (reclaiming a frame) page faults: 185
Voluntary context switches: 8
Involuntary context switches: 1
Swaps: 0
File system inputs: 0
File system outputs: 0
Socket messages sent: 0
Socket messages received: 0
Signals delivered: 0
Page size (bytes): 4096
Exit status: 0
 
Old 01-03-2009, 03:21 PM   #2
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
Hi, welcome to LQ!

I'd recommend reading "time"s man-page ...
namely the BUGS section.


Cheers,
Tink
 
Old 01-03-2009, 03:31 PM   #3
skyrenderx
LQ Newbie
 
Registered: Jan 2009
Posts: 3

Original Poster
Rep: Reputation: 0
The BUGS section reads as follows:

BUGS
Not all resources are measured by all versions of Unix, so some of the values might be reported as zero. The present selection was mostly inspired by the data provided by 4.2 or 4.3BSD. GNU time version 1.7 is not yet localized. Thus, it does not implement the POSIX requirements.

So it would appear that my version of Linux does not support measuring the memory via "time". Is there another way? Another utility to measure memory usage? I want to see the maximum memory used.
 
Old 01-03-2009, 04:10 PM   #4
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
You could use ps (which would have been my weapon of choice),
but that only works well for longer running processes...

If you need a more detailed break-down, use valgrind


Cheers,
Tink
 
Old 01-03-2009, 04:22 PM   #5
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 15,647

Rep: Reputation: 2092Reputation: 2092Reputation: 2092Reputation: 2092Reputation: 2092Reputation: 2092Reputation: 2092Reputation: 2092Reputation: 2092Reputation: 2092Reputation: 2092
Linux doesn't keep any performance/monitoring stats worth spit. You'll need to track the instantaneous usage by sampling /proc for the appropriate numbers. Can be done easily enough, but collectl (or maybe sysstat) is probably the best bet for maintaining historical data.
Still requires you to determine the max usage, but at least you'll have some data to work with.
 
Old 01-04-2009, 12:59 AM   #6
skyrenderx
LQ Newbie
 
Registered: Jan 2009
Posts: 3

Original Poster
Rep: Reputation: 0
I checked out sysstat as you suggested and found that it fits my needs. All I did was run it from within a shell script in order to collect data at periodic intervals. Thanks a bunch!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Standard commands give "-bash: open: command not found" even in "su -" and "su root" mibo12 Linux - General 4 11-11-2007 10:18 PM
"Broken" envirnment variable (MANPATH) and "/etc/profile.d" question. ErV Slackware 3 03-20-2007 09:42 AM
ARP command is "broken" vexer Linux - Networking 11 02-10-2006 01:15 PM


All times are GMT -5. The time now is 11:50 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration