- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Any other utility can used to check CPU time like ...
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-18-2005 01:03 AM
11-18-2005 01:03 AM
Any other utility can used to check CPU time like "top"?
Although "top" can be used to check the current "Raw CPU percentage" ("%CPU") and "Number of system and CPU seconds process has consumed" (TIME) of each process, but I don't know how to use "top" output for scripting.
Is there any other utility like "top" to get the "%CPU" and "TIME" of the process?
Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-18-2005 01:15 AM
11-18-2005 01:15 AM
Re: Any other utility can used to check CPU time like "top"?
The best way to do this would be to leverage MeasureWare to collect data & PerfView to analyze it.
These are purchased products, but are designed to get to the process level much better than anything else.
My 2 cents,
Jeff
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-18-2005 01:15 AM
11-18-2005 01:15 AM
Re: Any other utility can used to check CPU time like "top"?
If you would like to capture the output of 'top' into a file use the '-f file' switch and argument. For instance, to capture one snapshot, do:
# top -d 1 -f /tmp/top.output
Otherwise, I suggest using 'ps'. If you leverage the UNIX95 option, the outpuf of the time can be displayed in the format "[dd-]hh:mm:ss" instead of "mmmm:ss". This can make things easier.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-18-2005 01:26 AM
11-18-2005 01:26 AM
Re: Any other utility can used to check CPU time like "top"?
#checkproc -- This script view only user related processes
ps -ef |grep -v informix|grep -v root |grep -v lp|awk '{print $4, $1, $2, $7, $8, $9, $10, $11, $12,$13, $14, $15}' |sort -r| head -10
#chkps.sh
# this file appends information in a log to show High Water Marks through the day. Note Column #3
export line1=`checkproc |head -2 |tail -1`
export line2=`checkproc |head -3 |tail -1`
export line3=`checkproc |head -4 |tail -1`
export line4=`checkproc |head -5 |tail -1`
export line5=`checkproc |head -6 |tail -1`
export d=`date +%D`
export t=`date +%T`
echo $d $t $line1 >> /restore/`date +%Y%m%d`chkproc.log
echo $d $t $line2 >> /restore/`date +%Y%m%d`chkproc.log
echo $d $t $line3 >> /restore/`date +%Y%m%d`chkproc.log
echo $d $t $line4 >> /restore/`date +%Y%m%d`chkproc.log
echo $d $t $line5 >> /restore/`date +%Y%m%d`chkproc.log
it is a way to log it at very least, I use it for troubleshooting a vendor app that periodically gives me headaches.. I've isolated several apps that the vendor was forced to re-write because of this.
Generally the DB is not the problem unless you don't have it tuned correctly.. More likely it is an application with inefficient queries..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-18-2005 01:41 AM
11-18-2005 01:41 AM
Re: Any other utility can used to check CPU time like "top"?
Jeff: I don't think I can get it approved to buy an extra product for this purpose, but thanks for your advice!
James: I really don't want to use temporary file for scripting unless I don't have any other choice, that's why I raise the question here. And how "ps" can show the "%CPU" ? ( I need to grep the oracle process keeps consuming 100% CPU ), like this:
CPU TTY PID USERNAME PRI NI SIZE RES STATE TIME %WCPU %CPU COMMAND
4 ? 4243 oracle 239 20 4562M 12460K run 1029:15 100.57 100.40 oracleRMS_PROD
Rex: I read through your script, but where to get "%CPU" ?
Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-18-2005 02:00 AM
11-18-2005 02:00 AM
Re: Any other utility can used to check CPU time like "top"?
TERM=ansi top -d 1 | col -b |
awk '/^CPU[[:space:]]*TTY/,EOF{print}' | tail +2
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-18-2005 02:06 AM
11-18-2005 02:06 AM
Re: Any other utility can used to check CPU time like "top"?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-18-2005 02:33 AM
11-18-2005 02:33 AM
Re: Any other utility can used to check CPU time like "top"?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-18-2005 02:44 AM
11-18-2005 02:44 AM
Re: Any other utility can used to check CPU time like "top"?
UNIX95= ps -e -o ruser,pid,pcpu,args
the 3rd column will be %cpu
see the man page for ps if you need additional columns or want it formatted differently.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-18-2005 03:05 AM
11-18-2005 03:05 AM
Re: Any other utility can used to check CPU time like "top"?
thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-18-2005 03:48 AM
11-18-2005 03:48 AM
Re: Any other utility can used to check CPU time like "top"?
but in any case, either with ps or top, the %cpu reported is just for the last scheduling interval. So if you see 100% and 1000 minutes in any one report, it only means that it used 100% over the past couple of seconds. you need to collect data over time and parse it to really say that it used >x% over any period of time.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-18-2005 06:07 AM
11-18-2005 06:07 AM