Questions about prstat and CPU utility


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Questions about prstat and CPU utility
# 1  
Old 07-02-2010
Questions about prstat and CPU utility

Question 1:
I want to store the result of prstat to a file.
If I write in this way: prstat -a >>prstat.log, the result of prstat is stored to the file prstat.log correctly;
but if I write it in this waySmilierstat -a |grep abc>>prstat.log
(abc is the name of a program since I only want to trace the information of this program), the prstat.log is always empty. what is wrong with the command? What is the right way to write the prstat result of abc to prstat.log?

Question 2:
I have a salaries machine with multiple CPU, and program abc is a single thread program so it only uses one CPU. How to know the CPU utility of abc in the CPU it uses? Currently I use prstat or top but they only shows CPU utility of abc in multiple CPUs.

Thanks,
# 2  
Old 07-02-2010
Ad. 1:
Code:
prstat -a -c 1 | grep abc >> prstat.log

# 3  
Old 07-02-2010
Quote:
Originally Posted by bartus11
Ad. 1:
Code:
prstat -a -c 1 | grep abc >> prstat.log

do not work, the file is still empty


I found the reason maybe prstat -a does not terminate itseld. In fact if I run:
pmap -x <PID> |grep heap >>pmap.log, the result is stored to the file.
the difference between prstat and pmap here is pmap only executes one time and then terminates; while prstat does not terminate until you stop it.

But still, I do not know how to store result of prstat to a file. Thanks

Last edited by lilili07; 07-02-2010 at 07:13 PM..
# 4  
Old 07-02-2010
If you want only 1 prstat output, then this will work:
Code:
prstat -a -c 1 1 | grep abc >> prstat.log

This User Gave Thanks to bartus11 For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Solaris

Questions regarding CPU cores vs rctl limit

Hi, I am trying to gather cpu core details and used this script - Solaris & Scripting: Script - Find cpu - model / type / count / core / thread / speed - Solaris Sparc For auuditing purpose, we want to know how many cores are being used by Oracle, because oracle license will be charged on... (2 Replies)
Discussion started by: solaris_1977
2 Replies

2. Solaris

Capture PRSTAT based on CPU usage percentage

Hi, Recently i have write a simple script to capture CPU high usage based on prstat but i found out that it did capture correctly. I need to capture the rows that contains CPU usage more than 3%. Below line which i thought will capture CPU usage based CPU column in prstat(9th parameter) which is... (3 Replies)
Discussion started by: tharmendran
3 Replies

3. UNIX for Dummies Questions & Answers

Is it possible to combine multiple CPU to act as a single CPU on the same server?

We have a single threaded application which is restricted by CPU usage even though there are multiple CPUs on the server, hence leading to significant performance issues. Is it possible to merge / combine multiple CPUs at OS level so it appear as a single CPU for the application? (6 Replies)
Discussion started by: Dissa
6 Replies

4. Homework & Coursework Questions

Print questions from a questions folder in a sequential order

1.) I am to write scripts that will be phasetest folder in the home directory. 2.) The folder should have a set-up,phase and display files I have written a small script which i used to check for the existing users and their password. What I need help with: I have a set of questions in a... (19 Replies)
Discussion started by: moraks007
19 Replies

5. Shell Programming and Scripting

How to Unzip a file using unzip utility for files zipped without zip utility ?

Hi, I need to zip/compress a data file and send to a vendor. The vendor does have only unzip utility and can accept only .ZIP files. I do not have zip utility in my server. How do I zip/compress the file so that it can be deflated using unzip command ? I tried gzip & compress commands, but... (1 Reply)
Discussion started by: Sabari Nath S
1 Replies

6. Solaris

prstat

hi all, was trying to figure out how busy my app was by looking at the performance of the app server. did a 'prstat -s rss' command to find the app servers using most memory. Found a command 'prstat -m' which is meant to show more details on each pid but the output of this command... (1 Reply)
Discussion started by: cesarNZ
1 Replies

7. Shell Programming and Scripting

prstat

hi all, am writing a ksh script on solaris 9 to get the number of threads taken by a process. am using the prstat -p command to do this. output i get is : :"/export/home/user" > prstat -p 25528 | cut -f2 -d/ NLWP 203 Total: 1 processes, 203 lwps, load averages: 2.58, 3.24, 3.62... (2 Replies)
Discussion started by: cesarNZ
2 Replies

8. Solaris

Multi CPU Solaris system shows 100% CPU usage.

Hello Friends, On one of my Solaris 10 box, CPU usage shows 100% using "sar", "vmstat". However, it has 4 CPUs and prstat and glance are not showing enough processes to justify high CPU utilization. ========================================================================= $ prstat -a ... (4 Replies)
Discussion started by: mahive
4 Replies

9. Solaris

prstat O/P

Good Evening everyone, I am confused about prstat O/P as it shows memory values which are different from actual value.Below is the O/P of prstat command and swap commands. NPROC USERNAME SIZE RSS MEMORY TIME CPU 48 root 2113M 1590M 1.2% 45:09.39 32% 31 daemon ... (7 Replies)
Discussion started by: vvpotugunta
7 Replies

10. UNIX for Dummies Questions & Answers

how to get persistant cpu utilization values per process per cpu in linux (! top,ps)

hi, i want to know cpu utilizatiion per process per cpu..for single processor also if multicore in linux ..to use these values in shell script to kill processes exceeding cpu utilization.ps (pcpu) command does not give exact values..top does not give persistant values..psstat,vmstat..does njot... (3 Replies)
Discussion started by: pankajd
3 Replies
Login or Register to Ask a Question