Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

memory used

Status
Not open for further replies.

yi

Programmer
Aug 9, 2000
4
US
I need to find out how much memory a C code uses and how long it takes to run.  What command should I use to get this information?
 
Hi,<br><br>The command 'ps u' gives you size and resident set size figures -- use 'man ps' for some good definitions of these fields<br><FONT FACE=monospace><b><br>USER&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;PID %CPU %MEM&nbsp;&nbsp;&nbsp;SZ&nbsp;&nbsp;RSS&nbsp;&nbsp;&nbsp;&nbsp;TTY STAT&nbsp;&nbsp;&nbsp;&nbsp;STIME&nbsp;&nbsp;TIME COMMAND<br>root&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;13772&nbsp;&nbsp;0.0&nbsp;&nbsp;0.0&nbsp;&nbsp;352&nbsp;&nbsp;412&nbsp;&nbsp;pts/0 A&nbsp;&nbsp;&nbsp;&nbsp;11:06:42&nbsp;&nbsp;0:00 ksh<br>root&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;11394&nbsp;&nbsp;0.0&nbsp;&nbsp;0.0&nbsp;&nbsp;208&nbsp;&nbsp;260&nbsp;&nbsp;pts/0 A&nbsp;&nbsp;&nbsp;&nbsp;13:13:40&nbsp;&nbsp;0:00 ps u<br></font></b><br><br>Use the 'time' command to see how long your programs take to run -- like this 'time ls' <p>Mike<br><a href=mailto:michael.j.lacey@ntlworld.com>michael.j.lacey@ntlworld.com</a><br><a href= Cargill's Corporate Web Site</a><br>
 
You could also try the &quot;top&quot; command for memory as well. I just learned about a week or so ago.<br> <p>Troy Williams B.Eng.<br><a href=mailto:fenris@hotmail.com>fenris@hotmail.com</a><br><a href= > </a><br>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top