CPU usage

Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers CPU usage
# 1  
CPU usage

well i want to get the cpu usage of the current processes.the thing is that i want to list the processes with cpu usage=0 and the others(one list for cpu usage=0 and another for cpu usage>0)..i can list them,but i cant find a way to find the ps with cpu usage=0 and cpu usage>0..pls help me with this!
# 2  
@ straw, as per my guess , while redirecting the output of top (or) prstat , the CPU occupied processes only gets filed in the output file. We can see the zero % CPU occupied processes only in terminal session ..

Same query .. https://www.unix.com/unix-dummies-que...#post302587531
# 3  
(As a said on your other similar thread).
Please state what Operating System and version you have and what Shell you prefer.
There is much variation in commands to find out about processes.

Are you interested in current CPU usage percentage, or total CPU usage since the process started?

There is no point anybody posting guesses which might or might not work on your system until we know something about your system. We know from another thread that you prefer not to use "awk" - this will limit the possibilities.

Please post sample command and sample output from your "ps" command.
# 4  
i have solaris on my pc and the latest version of ubuntu at the other pc(the one i'm using right now)...like i said i'm trying to write a shell script or better i want to learn how i can write a shell script that outputs the current processes with zero cpu usage( %cpu ==0 ).
but i don't know how to make that possible..i think the top command is the one that i may use but i'm not sure..
# 5  
If (and only if) your systems support the Berkeley unix syntax for the "ps" command where you can choose the columns (e.g. cpu percentage).

e.g. Something like this:
ps -e -o pcpu,ruser,pid,args|grep \^" 0.00"

Others with the same O/S as you may be able to advise.
This User Gave Thanks to methyl For This Post:
# 6  
ok i get it!with this the output will be a list with processes with zero %cpu the name of the user and the pid of the process...and with grep (and the \^ before grep) we can get the columns with "0.00"...what is args?its not necessary i think..
# 7  
Within "ps", "args" is the command which was being run. Can help to work out which process is which. Depends what you are looking for.

The \^ before "grep" means "lines starting with". In my version of "ps" there is a single space character at the beginning of the line before the cpu percentage. Yours could be quite different.

Previous Thread | Next Thread
Thread Tools Search this Thread
Search this Thread:
Advanced Search

Test Your Knowledge in Computers #307
Difficulty: Easy
The common software-programming acronym 18N comes from the term Interlocalization;.
True or False?

10 More Discussions You Might Find Interesting

1. HP-UX

CPU Usage

Hi Experts, We encountered problem in one of the production system where some processes were taking higher CPU and after some time it came back to normal.. From system prespective, is there any way to check why processes took more cpu during that particular period. (16 Replies)
Discussion started by: sai_2507
16 Replies

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

3. Windows & DOS: Issues & Discussions

CPU usage

Hi all, Top command is used to monitor CPU usage in unix,solaris etc..likewise is there any command in windows environment? Regards William (3 Replies)
Discussion started by: William1482
3 Replies

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

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

7. Programming

Cpu usage

Hi all, When I have a below while loop in my code (This observation is same for C and Perl) i= 0; while(1) { i++; } for above the CPU uses goes beyond 49% on hp-ux machine, why cpu usage increase at this level for just a simple while loop? and if I have a single print statement... (2 Replies)
Discussion started by: zing_foru
2 Replies

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

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

10. Filesystems, Disks and Memory

cpu usage

hi, In response to your cpu usage answer I too read sys/sysinfo.h but , if we put these values to access the repective time fields in the array pst_cpu_time which is a member of the structure pst_dynamic values doesn't seem to match, why is like this? (0 Replies)
Discussion started by: sushaga
0 Replies

Featured Tech Videos