Visit Our UNIX and Linux User Community


CPU usage of particular processes


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting CPU usage of particular processes
# 1  
Old 11-07-2009
CPU usage of particular processes

How can i determine the CPU usage of particular processes like mysqld,httpd etc. using shell script?
# 2  
Old 11-07-2009
on bash ...

Code:
ps -aecv | grep "your app" | awk '{print $11}'

# 3  
Old 11-07-2009
But it doesn't show the cumulative cpu usage of a application?
# 4  
Old 11-07-2009
It shows the cpu usage at a time in percent
# 5  
Old 11-07-2009
Code:
[root@mypbxadmin ~]# ps aecv
  PID TTY      STAT   TIME  MAJFL   TRS   DRS   RSS %MEM COMMAND
 2954 pts/0    R+     0:00      0    74  8289   696  0.0 ps
 6003 tty1     Ss+    0:00      0    10  3781   492  0.0 mingetty
 6004 tty2     Ss+    0:00      0    10  3781   492  0.0 mingetty
 6005 tty3     Ss+    0:00      0    10  3781   492  0.0 mingetty
 6006 tty4     Ss+    0:00      0    10  3781   488  0.0 mingetty
 6007 tty5     Ss+    0:00      0    10  3781   492  0.0 mingetty
 6009 tty6     Ss+    0:00      0    10  3781   492  0.0 mingetty
18939 pts/0    Ss     0:00      0   710 65385  1540  0.0 bash
19106 pts/0    S      0:00      0   710 10221  1492  0.0 bash

Code:
[root@mypbxadmin ~]# ps -C openser
  PID TTY          TIME CMD
 6059 ?        00:00:00 openser
 6089 ?        00:00:31 openser
 6091 ?        00:00:31 openser
 6093 ?        00:00:30 openser
 6094 ?        00:00:31 openser
 6096 ?        00:00:30 openser
 6098 ?        00:00:31 openser
 6100 ?        00:00:30 openser
 6102 ?        00:00:30 openser
 6104 ?        00:00:07 openser
 6106 ?        00:00:00 openser
 6108 ?        00:00:00 openser
 6110 ?        00:00:00 openser
 6112 ?        00:00:00 openser
 6114 ?        00:00:00 openser
 6116 ?        00:00:00 openser
 6118 ?        00:00:00 openser
 6120 ?        00:00:00 openser
 6122 ?        00:00:00 openser
 6126 ?        00:00:00 openser

Code:
[root@mypbxadmin ~]# ps aecv | grep "openser" | awk '{print $11}'
No output

# 6  
Old 11-08-2009
NOT
Code:
ps aecv

BUT
Code:
ps -aecv

# 7  
Old 11-08-2009
use command below

Code:
prstat

BR

Previous Thread | Next Thread
Test Your Knowledge in Computers #550
Difficulty: Medium
The string concatenation operator can sometimes be combined with non-string types; numerical types.
True or False?

10 More Discussions You Might Find Interesting

1. AIX

Identify All Processes memory and cpu usage.

Hi All, Anyone has script to monitor AIX total processes memory and cpu usage that contribute to the total memory and CPU utilize so far ? The purpose of this is to analyze process memory trend. Thanks. Best Regards, ckwan (2 Replies)
Discussion started by: ckwan
2 Replies

2. UNIX for Advanced & Expert Users

CPU utilization by processes

OS is HP Number of CPU available is 4 I am running 8 multiple parallel application processes. I observed that the application is NOT able to occupy maximum CPU. Out of 4, 2 of them are used by 89% and 11% respectively. Where as other two are always sitting idle. Can anyone please comment... (3 Replies)
Discussion started by: sbiswas
3 Replies

3. AIX

Script to identify high CPU usage processes

Hi Guys, I need to write a script capable of identifying when a high cpu utilitzation process. It sounds simple but we are on a AIX 5.3 environment with Virtual CPU's (VP's) and logical CPU's. Please any ideas or tips would be highly appreciated. Thanks. Harby. (6 Replies)
Discussion started by: arizah
6 Replies

4. UNIX for Advanced & Expert Users

Monitoring cpu usage of mysql processes/threads/queries without any tool

hi all, i want to monitor mysql processes/threads/queries with respect to cpu usage.how can i do it? show processlist is of no use as no information abt cpu usage is given. plz help (7 Replies)
Discussion started by: rohitmahambre
7 Replies

5. AIX

How to monitor the IBM AIX server for I/O usage,memory usage,CPU usage,network..?

How to monitor the IBM AIX server for I/O usage, memory usage, CPU usage, network usage, storage usage? (3 Replies)
Discussion started by: laknar
3 Replies

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

7. Solaris

current CPU usage, memory usage, disk I/O oid(snmp)

Hi, I want to monitor the current cpu usage, monitor usage , disk I/o and network utlization for solaris using SNMP. I want the oids for above tasks. can you please tell me that Thank you (2 Replies)
Discussion started by: S_venkatesh
2 Replies

8. HP-UX

how can I find cpu usage memory usage swap usage and logical volume usage

how can I find cpu usage memory usage swap usage and I want to know CPU usage above X% and contiue Y times and memory usage above X % and contiue Y times my final destination is monitor process logical volume usage above X % and number of Logical voluage above can I not to... (3 Replies)
Discussion started by: alert0919
3 Replies

9. Programming

CPU usage and memory usage

Please tell me solaris functions/api for getting following information 1- Function that tells how much memory used by current process 2- Function that tells how much memory used by all running processes 3- Function that tells how much CPU is used by current process 4- Function that tells how... (1 Reply)
Discussion started by: mansoorulhaq
1 Replies

10. Programming

Monitor CPU usage and Memory Usage

how can i monitor usages of CPU, Memory, Hard disk etc. under SUN Solaries through a c program or java program i want to store that data into database so i can show it graphically thanks in advance (2 Replies)
Discussion started by: Gajanad Bihani
2 Replies

Featured Tech Videos