. load average calculation changed to calculate it all over every tick

instead of keeping a running total of enqueued processes
   (because somehow the load average was broken)
 . added SI_KPROC_TAB to get a copy of kernel process table from PM, for
   a top implementation
 . fixed arg to sys_nice() to make it an endpoint, not a slot number
This commit is contained in:
Ben Gras
2006-03-16 09:33:35 +00:00
parent e61522402a
commit eae250dea4
7 changed files with 18 additions and 14 deletions

View File

@@ -288,6 +288,8 @@ PUBLIC unsigned long read_clock()
PRIVATE void load_update(void)
{
u16_t slot;
int enqueued = -1, q; /* -1: special compensation for IDLE. */
struct proc *p;
/* Load average data is stored as a list of numbers in a circular
* buffer. Each slot accumulates _LOAD_UNIT_SECS of samples of
@@ -301,8 +303,12 @@ PRIVATE void load_update(void)
kloadinfo.proc_last_slot = slot;
}
/* Cumulation. */
kloadinfo.proc_load_history[slot] += kloadinfo.procs_enqueued;
/* Cumulation. How many processes are ready now? */
for(q = 0; q < NR_SCHED_QUEUES; q++)
for(p = rdy_head[q]; p != NIL_PROC; p = p->p_nextready)
enqueued++;
kloadinfo.proc_load_history[slot] += enqueued;
/* Up-to-dateness. */
kloadinfo.last_clock = realtime;

View File

@@ -145,9 +145,6 @@ PUBLIC void main()
alloc_segments(rp);
}
/* Special compensation for IDLE - don't let it count in the load average. */
kloadinfo.procs_enqueued--;
#if ENABLE_BOOTDEV
/* Expect an image of the boot device to be loaded into memory as well.
* The boot device is the last module that is loaded into memory, and,

View File

@@ -536,8 +536,6 @@ register struct proc *rp; /* this process is now runnable */
/* Now select the next process to run. */
pick_proc();
kloadinfo.procs_enqueued++;
#if DEBUG_SCHED_CHECK
rp->p_ready = 1;
check_runqueues("enqueue");
@@ -587,13 +585,9 @@ register struct proc *rp; /* this process is no longer runnable */
prev_xp = *xpp; /* save previous in chain */
}
kloadinfo.procs_enqueued--;
#if DEBUG_SCHED_CHECK
rp->p_ready = 0;
check_runqueues("dequeue");
if(kloadinfo.procs_enqueued < 0)
kprintf("%d processes enqueued\n", kloadinfo.procs_enqueued);
#endif
}

View File

@@ -66,7 +66,6 @@ U16_t parmoff, parmsize; /* boot parameters offset and length */
kinfo.kmem_size = (phys_bytes) &end;
/* Load average data initialization. */
kloadinfo.procs_enqueued = 0;
kloadinfo.proc_last_slot = 0;
for(h = 0; h < _LOAD_HISTORY; h++)
kloadinfo.proc_load_history[h] = 0;