Help answer threads with 0 replies.
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 03-04-2008, 09:42 AM   #1
Registered: Feb 2003
Location: Orangeville
Distribution: Fedora
Posts: 461

Rep: Reputation: 31
Question Identify program memory usage from command line

Me again with memory questions.

I have one or many programs that run periodically which have a high demand for memory.

They start up... through a large portion to swap, then finish up and release their memory. Then the 200K-800K or so is filled up with disk cache, and slowly over the day swaps in the 200K-800K.

I want to identify which programs they are. Is there a command line tool, which I can dump the output to log file, that will report the rough memory usage of a program?
Old 03-04-2008, 12:16 PM   #2
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,047
Blog Entries: 11

Rep: Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908
top -b -n 1 and a for loop ... for instance to capture
roughly an hour
for z in `seq 1 3600`; do top -b -d 1 -n 1| awk -f top.awk;sleep 1; done | tee topoutput
where top.awk looks something like this (here it would give you the
top-20 memory hogs per run - see head):
  command = "LC_ALL=C sort -k 10,10gr|head -20"
    print line[i]
    print line[i]|& command
  close(command, "to")
  while ((command |& getline out) > 0)
    print out



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
how to find max memory usage for process in Linux by command line kashameni Linux - Newbie 9 06-01-2007 02:39 AM
which program will monitor another programs memory usage? zidane_tribal Linux - Software 3 06-17-2006 06:56 PM
Sendmail command line usage Belghouth Debian 1 12-08-2004 11:54 AM
Memory usage of openGL program cjp Programming 3 09-09-2004 07:28 AM
checking memory usage from command line wrepti Linux - General 2 06-16-2004 11:24 PM

All times are GMT -5. The time now is 03:04 PM.

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