Operating System - HP-UX
1820669 Members
2465 Online
109626 Solutions
New Discussion юеВ

what does %WCPU column mean in TOP output ?

 
SOLVED
Go to solution
Jdamian
Respected Contributor

what does %WCPU column mean in TOP output ?

what is different between %CPU and %WCPU in top output ?
3 REPLIES 3
Massimo Bianchi
Honored Contributor

Re: what does %WCPU column mean in TOP output ?

Hi,
as far as i know, the difference is the following:

%CPU - % of time of cpu used

%WCPU - % of time waited for cpu

You can also check from "man top", it is explained.

Massimo


Jean-Louis Phelix
Honored Contributor
Solution

Re: what does %WCPU column mean in TOP output ?

Hi,

Have a look at this RCEN.

Regards.


UCMDSKBRC00009042
What is different between %CPU and %WCPU within top(1) ?
DocId: UCMDSKBRC00009042 Updated: 2/7/02 10:34:00 AM

PROBLEM
Online manual [ top(1) ] says that:

%WCPU is "Weighted CPU (central processing unit) percentage"
%CPU is "Raw CPU percentage. This field is used to sort the top processes".

The information is vague. Is there any more details on these values?RESOLUTION
%WCPU reported by top(1) is basically the reporting of the cpu
estimator which is reviewed by the hardclock() routine. The hardclock()
routine is apart of the process scheduling and adjusts the process running
priority when a process accumulates 40 ms.

Every 10ms, hardclock() runs and adjusts the process's time. This in turn will
affect the cpu estimator (p_cpu) and increases its value. This value is what
top(1) is reading via a pstat system call.

It essentially is a 'forecast' of the process to help determine its future
priority. As a process runs, its time increases and it can result in it
getting a low priority on a context switch.

Overview of hardclock() routine:

o check if process is valid
o increment clock tick for process
o increment cpu estimator
o check if cpu estimator has reached 40ms
o call setpri

This is a high level overview based on psuedo-code examples. Keep in
mind the cpu estimator ramps up quite quickly when a process is running
and decays away exponentially.

In summary:

The %WCPU is just a 'forecast' value for the process. It really has no
real world value. It's value is totally controlled by the scheduler.

The man page for top(1) indicates that %CPU is the "Raw CPU percentage. This
field is used to sort the top processes".

Well, the %CPU is the total percentage without the 'forecast' factor built-in,
such as a 'raw value.'


See below for information and how the value is determined for top. Notice that
the %CPU has no other variables to handle.

The following is a brief overview of the source code utilized:

Based on the source code for top.c:

* WCPU is the Weighted CPU that the kernel calculates to use in the
* scheduling algorithm.
* It is a weighted average over the last few minutes.


logcpu = log(ccpu);

Printw("%4.4s %5d %-8d %3d %2d %5d%c %5d%c %-5s %3d:%02d
%5.2f %5.2
f ", /* DSDe407527 */
gettty(pp->pst_major,pp->pst_minor),
pp->pst_pid,
pp->pst_uid,
pp->pst_pri,
pp->pst_nice,
processSize, processSizeUnits,
residentSize, residentSizeUnits,
state_name(pp->pst_stat, 1),
cputime / 60l,
cputime % 60l,
pp->pst_time == 0 ? 0.0 :


%WCPU ---> (100.0 * pctcpu / (1.0 - exp(pp->pst_time * logcpu))),
%CPU ---> (100.0 * pctcpu));
print_cmd(pp->pst_cmd);


Done.HP ONLY
"%wcpu" "%cpu" "top" "top(1)" "wcpu"


It works for me (┬й Bill McNAMARA ...)
Leif Halvarsson_2
Honored Contributor

Re: what does %WCPU column mean in TOP output ?

Hi,
WCPU is "Weighted cpu" average cpu for the process.