[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: load average patches for MiNT 1.10 + patches

>In-Reply-To: <2128.9403040748@elvis.earth.ox.ac.uk>
>>> hmm.  i haven't tried but i would suggest just using the 200 Hz timer
>>>counter (_hz_200) and doing calculations elsewhere...  because the 200 Hz
>>>interrupt runs at level 6 and the longer you run at levels >= 5 (6) the
>>>easier you lose characters on serial ports. (receiver overrun...)
>>The calculations are only done once per second, so the impact on the system
>>is minimal. The calculations themselves are merely a few adds, subtracts and
>>divides, all integer arithmetic, so not particularly slow to do.
>I say use the VBL routine to check your timer, but check the 200 Hz
>timer from in their. That way your one second timer will be accurate to
>either 1/50, 1/60, 1/70 second. This will cut down on system overhead,
>which is in my opion becoming too much for 8 MHz 68000s.

The overhead would not be significantly affected by moving the routine to
the VBL, if anything it would be increased, see my original version of
loadave for more details. Also, you are most likely to have clock drift due
to the inaccuracy of the test's timing.

The bulk of the routine is only called once per second, every other 1/200th
of a second a counter is merely decremented and tested, this is about 5
instructions I believe, not much of an overhead at all.

The routine which is called once a second traverses the process table
testing for processes on the run queue, adds them up, subtracts three values
taken from three arrays after scaling them with a shift and a divide, places
the total number of processes into three arrays, increments three pointers,
scales the current load with a shift and three divides and adds the value
the loadaverage values. Oh and it increments the uptime counter too.

Most of the time in this routine is taken traversing the process table, and
this would happen once a second whatever way I implemented loadaverages.

>From experiments, the increase in overhead is so little that I couldn't
measure the speed difference on my 520STM with 2.5MB RAM. (This is not my
development system.. I use my TT and Sun 3/80 for that.)

>Bye now,
>  Darryl
>| email through the InterNet to :-   drpiper@cix.compulink.co.uk |


Computer Systems Administrator, Dept. of Earth Sciences, Oxford University.
E-Mail: steve@uk.ac.ox.earth (JANET) steve@earth.ox.ac.uk (Internet).
Tel:- Oxford (0865) 282110 (UK) or +44 865 282110 (International).