10-09-2008
I believe this is similar to what you read in /proc/stat on Linux. In Linux, you can read the timer ticks spent on user, system and IO, IRQ etc using /proc/stat. But you need to calculate the CPU % by adding the total time spent against each category. Generally following is a common approach. If you look at source of procps (vmstat.c) you might be able to get an idea how it's done on Linux.
All CPU = User + System + Idle time
User CPU % = User / All CPU * 100%
System CPU % = System / All CPU * 100%
But you have to check where you can place pr_cutime and pr_cstime. It looks like it's part of User time.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I wonder how I shall read the result below, especially 'what'
shown below.
The result was shown when I entered 'w'.
E.g what is TOP? What is gosh ( what does selmgr mean?)?
login@ idle JCPU PCPU what
6:15am 7:04 39 39 TOP
6:34am 6:45 45 45 TOP
6:41am ... (1 Reply)
Discussion started by: Aelgen
1 Replies
2. UNIX for Dummies Questions & Answers
I have a question. Is Linux (Redhat 7.2 specifically) set up to run better/faster on a Pentium cpu vs. an AMD? The reason I ask is, I have a PIII 733 w/512 pc133, and a 4mb video card at work, and an AMD 1.4 w/1gb ddr, and a Radeon 64mb DDR at home, and the PIII at work runs a lot faster. I have a... (1 Reply)
Discussion started by: jeremiebarber
1 Replies
3. HP-UX
Using HP-UX v11
Need to monitor cpu and memory usage, total for system and separately for each user in command-line mode.
Found out next ways to monitor total cpu usage under hp-ux:
1) vmstat, also shows free memory
2) sar -M
ps -eo user,pcpu - does not work, means 'user-defined format'... (4 Replies)
Discussion started by: hp-ux-user
4 Replies
4. AIX
Hallo,
does anybody knows a trick to change the Processor ID in
AIX 4.3.3.
Thanks a lot (9 Replies)
Discussion started by: UXNI
9 Replies
5. Shell Programming and Scripting
Hi all,
I need a script that will check the cpu usage of a certain process and then kill the process if the % cpu is greater than 25%.
I know i can get the pid of a process by doing pidof <processname>.
Once I have the pid number is there a command in bash to return the current % cpu? (2 Replies)
Discussion started by: borderblaster
2 Replies
6. Shell Programming and Scripting
I'm writing a bash script to log some selections from a sensors output (core temp, mb temp, etc.) and I would also like to have the current cpu usage as a percentage. I have no idea how to go about getting it in a form that a bash script can use. For example, I would simply look in the output of... (3 Replies)
Discussion started by: graysky
3 Replies
7. Shell Programming and Scripting
Hi,
How can I find total CPU usage in percentage? e.g. if my system has 8 CPUs and I want to list total usage for all of them, is it possible through a command?
I have tried some of the commands like top, mpstat, sar. The output of those commands has to be manipulated to derive the percentage... (14 Replies)
Discussion started by: jal_capri
14 Replies
8. Hardware
Hello,
can anyone explain me this jargon "Nodes/Processor/CPU's/threads/packages":confused:
and what's the relation between these, I need to work on a cluster and I can not figure out the terminology. Thanks!
any good link to read about these would also be very helpful
Thanks!
... (1 Reply)
Discussion started by: nonothing
1 Replies
9. Solaris
Hi Gurus
Can someone help me in explaining the below outputs .
psrinfo -p
4
/usr/sbin/psrinfo -pv
The physical processor has 4 virtual processors (0-3)
SPARC64-VI (portid 1024 impl 0x6 ver 0x93 clock 2150 MHz)
The physical processor has 4 virtual processors (8-11)
SPARC64-VI... (3 Replies)
Discussion started by: ningy
3 Replies
10. Solaris
Hi,
Recently i have write a simple script to capture CPU high usage based on prstat but i found out that it did capture correctly. I need to capture the rows that contains CPU usage more than 3%. Below line which i thought will capture CPU usage based CPU column in prstat(9th parameter) which is... (3 Replies)
Discussion started by: tharmendran
3 Replies
LEARN ABOUT OSF1
pset_assign_pid
pset_assign_pid(1) General Commands Manual pset_assign_pid(1)
NAME
pset_assign_pid - Assigns a process ID to a processor set
SYNOPSIS
/usr/sbin/pset_assign_pid [-x] pset_id pid [pid...]
OPTIONS
Assigns exclusive use of the target processor set to each specified process identification number.
DESCRIPTION
The pset_assign_pid command assigns one or more process identification numbers to an existing processor set. The pset_id variable is a
unique integer that identifies the processor set and is returned by the pset_create command. The pid variable is the process identification
number, which is a unique integer that identifies the process. Each process identification number that is assigned is removed from its cur-
rent processor set.
Use the -x option to assign exclusive use of the processor set. If the processor set is already in use, a message is displayed, and the
command terminates without performing the assignment. If the exclusive assignment succeeds, new requests by other processes for assign-
ments to the specified processor set (pset_id) are denied.
SEE ALSO
Commands: pset_destroy(1), pset_create(1), pset_assign_cpu(1), pset_info(1)
Files: processor_sets(4)
pset_assign_pid(1)