LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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 09-22-2010, 02:49 AM   #1
Uni616
LQ Newbie
 
Registered: Sep 2010
Posts: 7

Rep: Reputation: 0
How to find total memory usage of a program?


Hello, I wrote a program that multiplies 2 matrices using multi-threads and another one using multiple processes and shared memory. Both in C.
I need to find the total memory usage of these programs. I know of the top command, but when my matrices are relatively small they don't even show up on top because they complete so fast, how can I find the memory usage for these instances?
Also, how can I find the total turnaround time of my programs?

Any help would be appreciated, thanks in advance.
 
Old 09-22-2010, 03:24 AM   #2
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,066
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
Have a look at valgrind .. may be sufficient.
 
Old 09-22-2010, 07:57 PM   #3
Uni616
LQ Newbie
 
Registered: Sep 2010
Posts: 7

Original Poster
Rep: Reputation: 0
Thanks a lot! That had just what I was looking for.
 
Old 09-22-2010, 10:43 PM   #4
quanta
Member
 
Registered: Aug 2007
Location: Vietnam
Distribution: RedHat based, Debian based, Slackware, Gentoo
Posts: 724

Rep: Reputation: 100Reputation: 100
You can use pmap or:
Code:
ps -eo size,pid,user,cmd | grep <process_name> | grep -v grep | awk '{ m+=$1 } END { print m }'
 
  


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
How to find total apache memory usage? j0hnsmith Linux - Server 7 09-13-2010 03:49 AM
Query: Embedded System - Total Memory Usage EmbeddedSteve Linux - Embedded & Single-board computer 1 08-20-2010 01:40 PM
most, er, universal way to get system memory total and usage lumix Linux - Newbie 1 06-03-2007 10:30 AM
Command to show each application/process memory usage and its total gn00kie Linux - Enterprise 2 09-21-2006 04:08 AM
Limiting the total amount of memory usage by apache. SplashHost.com Linux - General 8 08-30-2002 10:56 AM


All times are GMT -5. The time now is 08:30 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