Prstat substitute

 
Thread Tools Search this Thread
Contact Us Post Here to Contact Site Administrators and Moderators How to Post in the The UNIX and Linux Forums Prstat substitute
# 1  
Old 10-07-2015
Wrench Prstat substitute

Hello All,
I have a shell script where with the lines below:

Code:
echo "${v_sd_dateTime},${RUN_QUEUE_SIZE},${LOAD_AVERAGE},${v_sd_load_list},${v_sd_thread_count_list}" >> ${v_sd_file}

Format of the output :
Code:
   01/05/2005 08:00:00, RUN_QUEUE_SIZE, LOAD_AVG, CPU_PROD1, CPU_PROD2, THREADS_PROD1, THREADS_PR

Sample of the output :

Code:
01/07/2012 1:00	0	0.5	0.00%	0.50%	0.00%	74	29	69

prstat is used for the variables : ${v_sd_load_list},${v_sd_thread_count_list}

The scripts is as below:

Code:
v_gap_prstat_line=`prstat -p ${v_gpsd_pid} 5 1 | grep -vi TOTAL | grep -v CPU`

CPU_LOAD_INSTANCE=` echo ${v_gap_prstat_line} | awk '{ print $9 }'`
THREAD_COUNT_INSTANCE=`echo ${v_gap_prstat_line} | awk '{ print $10 }' | cut -d/ -f2`
    
CPU_LOAD_INSTANCE_LIST="${CPU_LOAD_INSTANCE_LIST} ${CPU_LOAD_INSTANCE}"
THREAD_COUNT_INSTANCE_LIST="${THREAD_COUNT_INSTANCE_LIST} ${THREAD_COUNT_INSTANCE}"
	
v_sd_load_list=`echo ${CPU_LOAD_INSTANCE_LIST} | sed -e 's/^  *//' -e 's/  */,/g'`
v_sd_thread_count_list=`echo ${THREAD_COUNT_INSTANCE_LIST} | sed -e 's/^  *//' -e 's/  */,/g'`

**********************


I understand that prstat takes the option p where it takes only the process id
5 being the number of times the statistics are repeated
1 being the interval in seconds

I have to migrate this in linux. I tried the command with

Code:
top -p 13213 -d 2 -n 1

But i dont get this output.
Could someone help.Smilie
Moderator's Comments:
Mod Comment Please use CODE tags when displaying sample input, sample output, and code segments.

Last edited by Don Cragun; 10-07-2015 at 04:47 AM.. Reason: Add CODE and ICODE tags.
# 2  
Old 10-09-2015
Apples vs. oranges with regards to NLWP counts... but let's see what is possible.... I have no idea if your logic will be sound... the systems are quite different.

replace:
Code:
v_gap_prstat_line=`prstat -p ${v_gpsd_pid} 5 1 | grep -vi TOTAL | grep -v CPU`

with:
Code:
v_gap_prstat_line=`top -b -n 1 -p ${v_gpsd_pid}  | tail -n 1`

For the NWLP number... well, perhaps if you get a thread list... so things change a bit.

change:
Code:
THREAD_COUNT_INSTANCE=`echo ${v_gap_prstat_line} | awk '{ print $10 }' | cut -d/ -f2`

try instead:
Code:
THREAD_COUNT_INSTANCE=`top -b -n 1 -H -p ${v_gpsd_pid}  | grep '^[ ]*[0-9]' | wc -l`

No warranties

---------- Post updated at 04:53 PM ---------- Previous update was at 04:51 PM ----------

Oh... and I just did -n 1... feel free to adjust... might need more work, but certainly on the right path (I think)
This User Gave Thanks to cjcox For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Solaris

Understanding prstat

Hello We have a SPARC box running Solaris 10. We have 32 GB of physical memory, 32 GB of swap. Now i want to monitor memory usage for performance tuning. The box is running Sybase database. When I type prstat i get the following PID USERNAME SIZE RSS STATE PRI NICE TIME CPU... (4 Replies)
Discussion started by: abohmeed
4 Replies

2. Shell Programming and Scripting

prstat with ksh

trying to have prstat into a file on a Solaris machine. Would like to have the prstat run from a cron every 30 min. print 300 lines+ date. Date is not printed, only the prstat, and ksh does not end, it stays running... #!/bin/ksh # ---------------------------------------------------- #... (4 Replies)
Discussion started by: pointer
4 Replies

3. Shell Programming and Scripting

prstat output

hi all, have a ksh script where i am doing a prstat -m -u osuser 1 1 >> $FILE_NAME but for some reason it only writes 15 lines wheres when i run the same command manually from command prompt it prints out 60 lines. why is it not writing the full 60 lines to the file ?? ta. (1 Reply)
Discussion started by: cesarNZ
1 Replies

4. 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

5. 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

6. 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

7. Shell Programming and Scripting

Script using prstat

Hi, I need a script which uses prstat command to check the performance . if a load averages crosses some threshold means I should receive the mail. this script should always run in back ground. Kindly help me on this. (1 Reply)
Discussion started by: jayaramanit
1 Replies

8. Shell Programming and Scripting

prstat problem

This will be a smaple output for my prstat -t NPROC USERNAME SIZE RSS MEMORY TIME CPU 43 root 249M 62M 1.5% 33:50:01 0.1% 12 oadmin 1396M 862M 22% 0:06:49 0.1% 2 acne 3960K 3176K 0.1% 0:00:00 0.0% 4 essagent 10M 7456K 0.2% 0:00:00 0.0%... (6 Replies)
Discussion started by: vivsiv
6 Replies

9. Shell Programming and Scripting

prstat in shell

Hello, How can I do to use prstat command in a korn-shell ? Thanks a lot. Rgds. (4 Replies)
Discussion started by: madmat
4 Replies

10. UNIX for Dummies Questions & Answers

Help with prstat

Hello, The last line of prstat shows load average. I am unable to figure out what actually it is. I have read the man pages and also googled, all for no use. Can somebody help me, as to what should be the avg. load of the system for best performance and how is this load of prstat calculated. (6 Replies)
Discussion started by: vibhor_agarwali
6 Replies
Login or Register to Ask a Question