The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Algorithm In Pseudocode delsega UNIX for Advanced & Expert Users 1 03-10-2008 11:10 AM
Help in Search Algorithm bourne SUN Solaris 1 10-24-2005 02:33 PM
FTP's algorithm toughguy2handle High Level Programming 1 09-23-2005 03:52 PM
Algorithm problem williamf High Level Programming 1 07-26-2004 02:12 PM
Feedback algorithm messier79 High Level Programming 0 03-17-2004 08:42 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 07-20-2007
filthymonk filthymonk is offline
Registered User
  
 

Join Date: May 2007
Posts: 59
algorithm

Code:
   PID USERNAME  SIZE   RSS STATE  PRI NICE      TIME  CPU PROCESS/NLWP
 21444 tomusr    213M   61M sleep   29   10   1:20:46 0.1% java/43
 21249 root       93M   44M sleep   29   10   1:07:19 0.2% java/56

is there anyway i can use a command to get the total of the SIZE? 306M (Derive from 213M + 93M from SIZE)
  #2 (permalink)  
Old 07-20-2007
ghostdog74 ghostdog74 is offline Forum Advisor  
Registered User
  
 

Join Date: Sep 2006
Posts: 2,538
Code:
awk '{s+=$3}END{print s}' file
however, if you have other units besides M, you have do some conversion first.
  #3 (permalink)  
Old 07-20-2007
matrixmadhan matrixmadhan is offline Forum Advisor  
Technorati Master
  
 

Join Date: Mar 2005
Location: leaf node in B+ tree
Posts: 2,954
I would like to add a small modification

Code:
awk '!/SIZE/ {s+=$3}END{print s}' file
  #4 (permalink)  
Old 07-20-2007
ghostdog74 ghostdog74 is offline Forum Advisor  
Registered User
  
 

Join Date: Sep 2006
Posts: 2,538
I think awk (GNU) knows how to take care of that
Code:
# more file
 PID USERNAME  SIZE   RSS STATE  PRI NICE      TIME  CPU PROCESS/NLWP
 21444 tomusr    213M   61M sleep   29   10   1:20:46 0.1% java/43
 21249 root       93M   44M sleep   29   10   1:07:19 0.2% java/56
# awk '{s+=$3}END{print s}' file
306
can you verify on your end? thanks
  #5 (permalink)  
Old 07-20-2007
filthymonk filthymonk is offline
Registered User
  
 

Join Date: May 2007
Posts: 59
as for my side i am using it on a prstat command ..

what i've done is

prstat -s size | awk '{s+=$3}END{print s}'

  #6 (permalink)  
Old 07-20-2007
blowtorch's Avatar
blowtorch blowtorch is offline Forum Advisor  
Supporter
  
 

Join Date: Dec 2004
Location: Singapore
Posts: 2,350
I thought that the 'SIZE' meant the total size of the process, while RSS meant the portion that was actually in the system memory.
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 08:55 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0