Sponsored Content
Operating Systems HP-UX How to summary one command's cpu usage? Post 302169744 by matt.d on Friday 22nd of February 2008 10:03:23 AM
Old 02-22-2008
On my box,
Code:
ps -e | grep oracle

Gives me output that looks like this (column numbers entered by me)
Code:
0123456789012345678901234567890
  8827 ?         0:00 oracle
  6849 ?         0:00 oracle
 25473 ?         0:12 oracle


So I guess you could do something like...
Code:
#!/usr/bin/perl

foreach (`ps -e | grep oracle | cut -c 17-21`) {
        # strip the colon
        s/://;
        $sum = $_ + $sum;
        }

        print $sum;

But I think it would be more important to look at "top" to see what oracle process is taking the most time if you are looking to tune.

Last edited by matt.d; 02-22-2008 at 01:18 PM..
 

10 More Discussions You Might Find Interesting

1. Filesystems, Disks and Memory

How do you display summary of disk usage?

I am trying to create a command string that makes use of the du or df utilities to show block count in kilobytes (1024 bytes) instead of multiples of 512 bytes, any suggestions? Thanks..... (3 Replies)
Discussion started by: klannon
3 Replies

2. Shell Programming and Scripting

Detailed disk usage versus age summary

Hi, I'm posting my question here as I fele that what I am about to try to do must have been done already, and I don't want to re-invent the wheel. I have recently become responsible for monitoring disk space usage for a large file system. I would like to geenrate reports that will summise... (8 Replies)
Discussion started by: littleIdiot
8 Replies

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

4. UNIX for Dummies Questions & Answers

top command + %CPU usage exceeds 100%?

Hi there. I was looking at the output from running top and for short amounts of time, when I see all the process running and add up the values in the %CPU column the value exceeds 100% (I just add them quickly in my head). I assume that if I were to add up all my processes in the entire list,... (2 Replies)
Discussion started by: Carl1976
2 Replies

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

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. UNIX for Dummies Questions & Answers

Unix Top Command and sorting by CPU Usage

Ok, so I am using the Top command on my linux VPS to try and see the processes using the most CPU %. I hit the P to sort by CPU % but it wants to sort them from lowest to highest (ascending). My Telnet-SSH screen is only about 60 rows high so the processes with the highest CPU % usage are at the... (6 Replies)
Discussion started by: davemehta
6 Replies

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

9. Shell Programming and Scripting

Command to check the CPU usage for particular user

Hi All, Can anybody knows, how to check the CPU usage in percentage for a particular process along with its user and PID? Thanks in advance!! (3 Replies)
Discussion started by: AB10
3 Replies

10. Linux

Ps command on cpu usage and time

Hi All, Am very new to Linux and unix ...need below help . need to list of process consuming more than 40% cpu and which are older than 10 days of a particular user .... Thanks V (4 Replies)
Discussion started by: venky456
4 Replies
SA(8)							    BSD System Manager's Manual 						     SA(8)

NAME
sa -- print system accounting statistics SYNOPSIS
sa [-abcdDfijkKlmnqrstu] [-P file] [-U file] [-v cutoff] [file ...] DESCRIPTION
The sa utility reports on, cleans up, and generally maintains system accounting files. The sa utility is able to condense the information in /var/account/acct into the summary files /var/account/savacct and /var/account/usracct, which contain system statistics according to command name and login id, respectively. This condensation is desirable because on a large sys- tem, /var/account/acct can grow by hundreds of blocks per day. The summary files are normally read before the accounting file, so that reports include all available information. If file names are supplied, they are read instead of /var/account/acct. After each file is read, if the summary files are being updated, an updated summary will be saved to disk. Only one report is printed, after the last file is processed. The labels used in the output indicate the following, except where otherwise specified by individual options: avio Average number of I/O operations per execution cp Sum of user and system time, in minutes cpu Same as cp k CPU-time averaged core usage, in 1k units k*sec CPU storage integral, in 1k-core seconds re Real time, in minutes s System time, in minutes tio Total number of I/O operations u User time, in minutes The options to sa are: -a List all command names, including those containing unprintable characters and those used only once. By default, sa places all names containing unprintable characters and those used only once under the name ``***other''. -b If printing command statistics, sort output by the sum of user and system time divided by number of calls. -c In addition to the number of calls and the user, system and real times for each command, print their percentage of the total over all commands. -d If printing command statistics, sort by the average number of disk I/O operations. If printing user statistics, print the average number of disk I/O operations per user. -D If printing command statistics, sort and print by the total number of disk I/O operations. -f Force no interactive threshold comparison with the -v option. -i Do not read in the summary files. -j Instead of the total minutes per category, give seconds per call. -k If printing command statistics, sort by the cpu-time average memory usage. If printing user statistics, print the cpu-time average memory usage. -K If printing command statistics, print and sort by the cpu-storage integral. -l Separate system and user time; normally they are combined. -m Print per-user statistics rather than per-command statistics. -n Sort by number of calls. -P file Use the specified file for accessing the per-command accounting summary database, instead of the default /var/account/savacct. -q Create no output other than error messages. -r Reverse order of sort. -s Truncate the accounting files when done and merge their data into the summary files. -t For each command, report the ratio of real time to the sum of user and system cpu times. If the cpu time is too small to report, ``*ignore*'' appears in this field. -U file Use the specified file for accessing the per-user accounting summary database, instead of the default /var/account/usracct. -u Superseding all other flags, for each entry in the accounting file, print the user ID, total seconds of cpu usage, total memory usage, number of I/O operations performed, and command name. -v cutoff For each command used cutoff times or fewer, print the command name and await a reply from the terminal. If the reply begins with ``y'', add the command to the category ``**junk**''. This flag is used to strip garbage from the report. By default, per-command statistics will be printed. The number of calls, the total elapsed time in minutes, total cpu and user time in min- utes, average number of I/O operations, and CPU-time averaged core usage will be printed. If the -m option is specified, per-user statistics will be printed, including the user name, the number of commands invoked, total cpu time used (in minutes), total number of I/O operations, and CPU storage integral for each user. If the -u option is specified, the uid, user and system time (in seconds), CPU storage integral, I/O usage, and command name will be printed for each entry in the accounting data file. If the -u flag is specified, all flags other than -q are ignored. If the -m flag is specified, only the -b, -d, -i, -k, -q, and -s flags are honored. FILES
/var/account/acct raw accounting data file /var/account/savacct per-command accounting summary database /var/account/usracct per-user accounting summary database EXIT STATUS
The sa utility exits 0 on success, and >0 if an error occurs. SEE ALSO
lastcomm(1), acct(5), ac(8), accton(8) AUTHORS
Chris G. Demetriou <cgd@postgres.berkeley.edu> CAVEATS
While the behavior of the options in this version of sa was modeled after the original version, there are some intentional differences and undoubtedly some unintentional ones as well. In particular, the -q option has been added, and the -m option now understands more options than it used to. The formats of the summary files created by this version of sa are very different from the those used by the original version. This is not considered a problem, however, because the accounting record format has changed as well (since user ids are now 32 bits). BUGS
The number of options to this program is absurd, especially considering that there is not much logic behind their lettering. The field labels should be more consistent. The VM system does not record the CPU storage integral. BSD
May 18, 2007 BSD
All times are GMT -4. The time now is 12:20 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy