Let top distinguish kernel time, explain in manpage.
This commit is contained in:
@@ -110,7 +110,7 @@ void print_procs(int maxlines,
|
||||
struct mproc *mproc)
|
||||
{
|
||||
int p, nprocs;
|
||||
int idleticks = 0;
|
||||
int idleticks = 0, kernelticks = 0;
|
||||
|
||||
for(p = nprocs = 0; p < PROCS; p++) {
|
||||
if(proc2[p].p_rts_flags & SLOT_FREE)
|
||||
@@ -127,13 +127,19 @@ void print_procs(int maxlines,
|
||||
idleticks = tick_procs[nprocs].ticks;
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Kernel task time, not counting IDLE */
|
||||
if(proc2[p].p_nr < 0)
|
||||
kernelticks += tick_procs[nprocs].ticks;
|
||||
nprocs++;
|
||||
}
|
||||
|
||||
qsort(tick_procs, nprocs, sizeof(tick_procs[0]), cmp_ticks);
|
||||
|
||||
printf("CPU states: %5.2f%% user, %5.2f%% idle\n\n",
|
||||
100.0*(dt-idleticks)/dt, 100.0*idleticks/dt);
|
||||
printf("CPU states: %5.2f%% user, %5.2f%% kernel, %5.2f%% idle\n\n",
|
||||
100.0*(dt-idleticks-kernelticks)/dt,
|
||||
100.0*(kernelticks)/dt,
|
||||
100.0*idleticks/dt);
|
||||
maxlines -= 2;
|
||||
|
||||
printf(" PID USERNAME PRI NICE SIZE STATE TIME CPU COMMAND\n");
|
||||
|
||||
Reference in New Issue
Block a user