The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com



UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
how to get persistant cpu utilization values per process per cpu in linux (! top,ps) pankajd UNIX for Dummies Questions & Answers 3 10-09-2008 12:26 PM
Awk to print distinct col values anduzzi Shell Programming and Scripting 22 08-18-2008 06:09 PM
Print column names along with values from SQL thana Shell Programming and Scripting 5 07-24-2008 03:33 AM
Print Problem in UNIX. Need to know the option to specify the print paper size ukarthik HP-UX 1 06-07-2007 10:35 AM
awk to print mon and max values of ranges Mudshark Shell Programming and Scripting 3 02-02-2006 03:06 PM

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 11-13-2008
ronit_ok2000 ronit_ok2000 is offline
Registered User
  
 

Join Date: Nov 2008
Posts: 2
how to print the values of pcpu of any process in unix

hiiiiiiiiii
this is shyam.i have written a code that it will take the process id of any process and using it print the value of pcpu etc but the problem is it prints
the same value every time it is in loop the code for this is given below.


while true
do
y=`ps -p $pid -o pid,ppid,user,group,pcpu,pmem,rss,osz,vsz,comm`
echo "$y"
sleep 1s
done
i want to print all the frquently changing values .
can anyone please help me
  #2 (permalink)  
Old 11-13-2008
demwz demwz is offline
Registered User
  
 

Join Date: Jun 2008
Posts: 128
Maybe watch comes close to what you are searching for:
watch ps -p $pid -o pid,ppid,user,group,pcpu,pmem,rss,osz,vsz,comm
  #3 (permalink)  
Old 11-13-2008
ronit_ok2000 ronit_ok2000 is offline
Registered User
  
 

Join Date: Nov 2008
Posts: 2
Quote:
Originally Posted by ronit_ok2000 View Post
hiiiiiiiiii
this is shyam.i have written a code that it will take the process id of any process and using it print the value of pcpu etc but the problem is it prints
the same value every time it is in loop the code for this is given below.


while true
do
y=`ps -p $pid -o pid,ppid,user,group,pcpu,pmem,rss,osz,vsz,comm`
echo "$y"
sleep 1s
done
i want to print all the frquently changing values .
can anyone please help me
thanks for ur advice but the thing i want to happen is to print different values of pcpu or pmem at intervals
13 1 root root 0.8 0 05:51:11 0.0 0 0 0 [kjournald]
13 1 root root 0.8 0 05:51:11 0.0 0 0 0 [kjournald]
13 1 root root 0.8 0 05:51:11 0.0 0 0 0 [kjournald]
13 1 root root 0.8 0 05:51:11 0.0 0 0 0 [kjournald]
13 1 root root 0.8 0 05:51:11 0.0 0 0 0 [kjournald]
13 1 root root 0.8 0 05:51:11 0.0 0 0 0 [kjournald]
13 1 root root 0.8 0 05:51:11 0.0 0 0 0 [kjournald]
13 1 root root 0.8 0 05:51:11 0.0 0 0 0 [kjournald]
13 1 root root 0.8 0 05:51:11 0.0 0 0 0 [kjournald]
this is the output where 0.8 is pcpu but everytime it is 0.8
but originally it is varying and i want pcpu to be varying everytime
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:36 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