CPU and memory utilization of a process, by process name

Can someone please help me with a script that will help in identifying the CPU & memory usage by a process name, rather than a process id.This is to primarily analyze the consumption of resources, for performance tweaking.

G

What's your system?

you can use nmon..

Hi,

Without knowing what OS you are using it's not easy to help, to get a feel for what is happening on your server/system thare are many scritps available.

However starting with the standard Unix/Linux tools is probably your best bet in the short term.

Tools like nmon will probably not suit your needs, more likely commands like "ptree", "ps", "top"(topas on AIX) and many others will be more suitable for this task.

As an example on a system using lots of oracle instances this will show you the actual memory being used.

#!/usr/bin/ksh

Today=`date +%y%m%d`
LOGFILE=/xxxxxxxx/log/ora-mem-use.log.$Today

for i in `ps -fuoracle|grep smon|cut -d "_" -f 3`
do
        date >> $LOGFILE
        echo "SID: $i" >> $LOGFILE
        export ORACLE_SID=${i}; /export/home/oracle/omemuse -SB >> $LOGFILE
        echo >> $LOGFILE
done

Regards

Dave

"man ps" so you can learn the various options you need for sorting and displaying the fields you are interested in. As noted by others above, these options vary slightly from system to system. (ie, Linux, Solaris, AIX, BSD)