Let top distinguish kernel time, explain in manpage.
This commit is contained in:
parent
96783ed1f7
commit
7fb338622b
2 changed files with 22 additions and 11 deletions
|
@ -110,7 +110,7 @@ void print_procs(int maxlines,
|
||||||
struct mproc *mproc)
|
struct mproc *mproc)
|
||||||
{
|
{
|
||||||
int p, nprocs;
|
int p, nprocs;
|
||||||
int idleticks = 0;
|
int idleticks = 0, kernelticks = 0;
|
||||||
|
|
||||||
for(p = nprocs = 0; p < PROCS; p++) {
|
for(p = nprocs = 0; p < PROCS; p++) {
|
||||||
if(proc2[p].p_rts_flags & SLOT_FREE)
|
if(proc2[p].p_rts_flags & SLOT_FREE)
|
||||||
|
@ -127,13 +127,19 @@ void print_procs(int maxlines,
|
||||||
idleticks = tick_procs[nprocs].ticks;
|
idleticks = tick_procs[nprocs].ticks;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Kernel task time, not counting IDLE */
|
||||||
|
if(proc2[p].p_nr < 0)
|
||||||
|
kernelticks += tick_procs[nprocs].ticks;
|
||||||
nprocs++;
|
nprocs++;
|
||||||
}
|
}
|
||||||
|
|
||||||
qsort(tick_procs, nprocs, sizeof(tick_procs[0]), cmp_ticks);
|
qsort(tick_procs, nprocs, sizeof(tick_procs[0]), cmp_ticks);
|
||||||
|
|
||||||
printf("CPU states: %5.2f%% user, %5.2f%% idle\n\n",
|
printf("CPU states: %5.2f%% user, %5.2f%% kernel, %5.2f%% idle\n\n",
|
||||||
100.0*(dt-idleticks)/dt, 100.0*idleticks/dt);
|
100.0*(dt-idleticks-kernelticks)/dt,
|
||||||
|
100.0*(kernelticks)/dt,
|
||||||
|
100.0*idleticks/dt);
|
||||||
maxlines -= 2;
|
maxlines -= 2;
|
||||||
|
|
||||||
printf(" PID USERNAME PRI NICE SIZE STATE TIME CPU COMMAND\n");
|
printf(" PID USERNAME PRI NICE SIZE STATE TIME CPU COMMAND\n");
|
||||||
|
|
|
@ -1,20 +1,25 @@
|
||||||
.TH TOP 1
|
.TH TOP 1
|
||||||
.SH NAME
|
.SH NAME
|
||||||
top \- show processes sorted by cpu usage
|
top \- show processes sorted by CPU usage
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
.B top
|
.B top
|
||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
Top displays a list of all running processes, once every update interval
|
Top displays a list of all running processes, once every update interval
|
||||||
(currently 5 seconds). It is sorted by the cpu usage of the processes in
|
(currently 5 seconds). It is sorted by the CPU usage of the processes in
|
||||||
the last interval. The first display is the cpu usage of processes since
|
the last interval. The first display is the CPU usage of processes since
|
||||||
the boot time.
|
the boot time.
|
||||||
|
|
||||||
At the top of the screen, top shows the current system load averages in
|
At the top of the screen, top shows the current system load averages in
|
||||||
the last 1-minute, 5-minute and 15-minute intervals. Then, over the
|
the last 1-minute, 5-minute and 15-minute intervals. Then, over the
|
||||||
last top interval it displays: the number of alive, active, and sleeping
|
last top interval it displays: the number of alive, active, and sleeping
|
||||||
processes; memory free; and cpu usage.
|
processes; memory free; and CPU usage. CPU usage is split into
|
||||||
|
user, kernel and idle time. Kernel time is time spent by kernel tasks,
|
||||||
|
that is tasks that run in kernel mode in kernel address space. User
|
||||||
|
time is all other CPU time, including system processes such as servers
|
||||||
|
and drivers, as top can't see the difference between a user process and
|
||||||
|
a server or driver.
|
||||||
|
|
||||||
Then it displays all the alive processes sorted by cpu usage in the last
|
Then it displays all the alive processes sorted by CPU usage in the last
|
||||||
interval, with a number of fields for every process. Currently the
|
interval, with a number of fields for every process. Currently the
|
||||||
following fields are displayed:
|
following fields are displayed:
|
||||||
.PP
|
.PP
|
||||||
|
@ -41,8 +46,8 @@ following fields are displayed:
|
||||||
STATE
|
STATE
|
||||||
RUN if the process is runnable, empty if blocking.
|
RUN if the process is runnable, empty if blocking.
|
||||||
TIME
|
TIME
|
||||||
Total number of cpu time spent in the process itself. So-called
|
Total number of CPU time spent in the process itself. So-called
|
||||||
system time (cpu time spent on behalf of this process by another
|
system time (CPU time spent on behalf of this process by another
|
||||||
process, generally a system process) is not seen here.
|
process, generally a system process) is not seen here.
|
||||||
CPU
|
CPU
|
||||||
Percentage of time that the process was running in the last interval.
|
Percentage of time that the process was running in the last interval.
|
||||||
|
@ -54,7 +59,7 @@ following fields are displayed:
|
||||||
.SH BUGS
|
.SH BUGS
|
||||||
This is a from-scratch reimplementation of top for MINIX 3.
|
This is a from-scratch reimplementation of top for MINIX 3.
|
||||||
Many features (such as interactive commands) are not implemented.
|
Many features (such as interactive commands) are not implemented.
|
||||||
Sorting is only done by cpu usage currently. Displayed state is
|
Sorting is only done by CPU usage currently. Displayed state is
|
||||||
only RUN or empty.
|
only RUN or empty.
|
||||||
.SH AUTHOR
|
.SH AUTHOR
|
||||||
Ben Gras (beng@few.vu.nl)
|
Ben Gras (beng@few.vu.nl)
|
||||||
|
|
Loading…
Reference in a new issue