[haiku] Re: Scheduler (was: Re: Re: Multi-track recording and compositing)

  • From: "Cyan" <cyanh256@xxxxxxxxxxxx>
  • To: haiku@xxxxxxxxxxxxx
  • Date: Sun, 07 Jun 2009 12:24:08 +0100 BST

Ingo Weinhold <ingo_weinhold@xxxxxx> wrote:

> On 2009-06-07 at 01:38:43 [+0200], André Braga <meianoite@xxxxxxxxx> 
> > wrote:
> > 2009/6/6 Stephan Assmus <superstippi@xxxxxx>:
> > [8<]
> > > Overall rating: [unacceptable]
> > [8<]
> > > Overall rating: [absolutely disgraceful]
> > [8<]
> > > Overall rating: [unacceptable]
> > 
> > Okay, this is broken. Definitely.
> 
> Without the source of the test program, it is really impossible to > 
> judge 
> what that means at all. Cyan, would you be so kind...


I /think/ this is the correct source file:

http://knothole.no-ip.org/timingtest1.c

Be warned that it's absolutely hideous. It's a rush-job that's had
bits tacked onto it, and it's just plain bad in every sense.

The basic premise is this:

- Set up a real time thread to measure the accuracy of
  snooze_until() calls. (priority=120 is used to simulate a realistic
  real-time thread priority, timing measurements might be better if
  it were forced to 127 but I didn't think that'd be very realistic?)

- Start doing things in another thread to simulate "system load"
  to see if the timing gets messed up. (it would be nice to extend
  this to multiple threads...)

- The "Misc. system load" part is a bunch of system() calls which
  invoke various apps (ls, dd, etc.) and perform disk I/O.
  This was intended to very (very!) roughly simulate "typical use",
  and brings some of the following things into play:

  1) Disk I/O (thus the disk controller drivers, disk cache, etc.)
  2) Process setup/teardown.
  3) Memory allocation/deallocation.
  4) Multiple "loading" threads/processes.

It would be interesting to extend the program to test memory
allocation/deallocation alone, heavy disk I/O (seek and linear)
alone, spawning new processes, loading images, etc.

It may be possible to pin-point where the bottlenecks are occurring
that way. Reassuringly, the overall jitter figures don't look too
bad at idle; the problem is mostly when there's some kind of external
load (or the "system load" test).

I can reproduce the poor "system load" results on this R5 system
by enabling the HLT instruction, and leaving the processors idle.
In other words, calling HLT seems to require some time to let the
processor recover (maybe the first interrupt is dropped/delayed?)
Spinning all four cores in a loop, even at minimum priority,
defeats the HLT calls and eliminates the jitter (as does disabling
the HLT instruction in the kernel config file).

I don't suppose this problem should crop up under Haiku, being so
different at the kernel level?


For reference, here are the results on this machine, quad-core, R5,
modified HDA driver + Haiku Media Kit Mixer installed and running:


HLT disabled (or all four cores loaded to defeat HLT), all four
CPUs enabled:

Version 1.0
Idle,  no CPU load random test...  18µs jitter [earth-shattering!]
Idle,  no CPU load 100Hz test....  22µs jitter [earth-shattering!]
Idle,  no CPU load 1kHz test.....  17µs jitter [earth-shattering!]
Pulsed normal load random test...  19µs jitter [earth-shattering!]
Pulsed normal load 100Hz test....  20µs jitter [earth-shattering!]
Pulsed normal load 1kHz test.....  21µs jitter [earth-shattering!]
Steady normal load random test...  17µs jitter [earth-shattering!]
Steady normal load 100Hz test....  20µs jitter [earth-shattering!]
Steady normal load 1kHz test.....  22µs jitter [earth-shattering!]
Pulsed urgent load random test...  14µs jitter [earth-shattering!]
Pulsed urgent load 100Hz test....  17µs jitter [earth-shattering!]
Pulsed urgent load 1kHz test.....  18µs jitter [earth-shattering!]
Steady urgent load random test...  22µs jitter [earth-shattering!]
Steady urgent load 100Hz test....  17µs jitter [earth-shattering!]
Steady urgent load 1kHz test.....  24µs jitter [earth-shattering!]
Pulsed R. T.  load random test...  14µs jitter [earth-shattering!]
Pulsed R. T.  load 100Hz test....  14µs jitter [earth-shattering!]
Pulsed R. T.  load 1kHz test.....  20µs jitter [earth-shattering!]
Pulsed R.T.D. load random test...  19µs jitter [earth-shattering!]
Pulsed R.T.D. load 100Hz test....  14µs jitter [earth-shattering!]
Pulsed R.T.D. load 1kHz test.....  19µs jitter [earth-shattering!]
Please wait...
Misc.  system load random test...  24µs jitter [earth-shattering!]
Misc.  system load 100Hz test....  31µs jitter [excellent]
Misc.  system load 1kHz test.....  32µs jitter [excellent]

Overall rating: [excellent]



HLT enabled and no external CPU load (so HLT is being called),
all four CPUs enabled:

Version 1.0
Idle,  no CPU load random test...  51µs jitter [excellent]
Idle,  no CPU load 100Hz test....  88µs jitter [very good]
Idle,  no CPU load 1kHz test..... 118µs jitter [very good]
Pulsed normal load random test... 122µs jitter [very good]
Pulsed normal load 100Hz test....  79µs jitter [very good]
Pulsed normal load 1kHz test.....  99µs jitter [very good]
Steady normal load random test...  74µs jitter [excellent]
Steady normal load 100Hz test....  66µs jitter [excellent]
Steady normal load 1kHz test.....  80µs jitter [very good]
Pulsed urgent load random test...  92µs jitter [very good]
Pulsed urgent load 100Hz test....  67µs jitter [excellent]
Pulsed urgent load 1kHz test..... 120µs jitter [very good]
Steady urgent load random test...  24µs jitter [earth-shattering!]
Steady urgent load 100Hz test....  84µs jitter [very good]
Steady urgent load 1kHz test..... 100µs jitter [very good]
Pulsed R. T.  load random test...  62µs jitter [excellent]
Pulsed R. T.  load 100Hz test....  75µs jitter [very good]
Pulsed R. T.  load 1kHz test..... 118µs jitter [very good]
Pulsed R.T.D. load random test...  63µs jitter [excellent]
Pulsed R.T.D. load 100Hz test....  70µs jitter [excellent]
Pulsed R.T.D. load 1kHz test.....  81µs jitter [very good]
Please wait...
Misc.  system load random test...2117µs jitter [absolutely disgraceful]
Misc.  system load 100Hz test....1004µs jitter [unacceptable]
Misc.  system load 1kHz test.....1970µs jitter [unacceptable]

Overall rating: [absolutely disgraceful]



HLT disabled (or the CPU loaded to defeat HLT), only one CPU
enabled:

Version 1.0
Idle,  no CPU load random test...  20µs jitter [earth-shattering!]
Idle,  no CPU load 100Hz test....  49µs jitter [excellent]
Idle,  no CPU load 1kHz test.....  39µs jitter [excellent]
Pulsed normal load random test...  17µs jitter [earth-shattering!]
Pulsed normal load 100Hz test....  21µs jitter [earth-shattering!]
Pulsed normal load 1kHz test.....  24µs jitter [earth-shattering!]
Steady normal load random test...  24µs jitter [earth-shattering!]
Steady normal load 100Hz test....  25µs jitter [earth-shattering!]
Steady normal load 1kHz test.....  25µs jitter [earth-shattering!]
Pulsed urgent load random test...  11µs jitter [earth-shattering!]
Pulsed urgent load 100Hz test....  17µs jitter [earth-shattering!]
Pulsed urgent load 1kHz test.....  23µs jitter [earth-shattering!]
Steady urgent load random test...  22µs jitter [earth-shattering!]
Steady urgent load 100Hz test....  13µs jitter [earth-shattering!]
Steady urgent load 1kHz test.....  25µs jitter [earth-shattering!]
Pulsed R. T.  load random test...  11µs jitter [earth-shattering!]
Pulsed R. T.  load 100Hz test....  19µs jitter [earth-shattering!]
Pulsed R. T.  load 1kHz test.....  31µs jitter [excellent]
Pulsed R.T.D. load random test...  22µs jitter [earth-shattering!]
Pulsed R.T.D. load 100Hz test....  22µs jitter [earth-shattering!]
Pulsed R.T.D. load 1kHz test.....  21µs jitter [earth-shattering!]
Please wait...
Misc.  system load random test...  36µs jitter [excellent]
Misc.  system load 100Hz test....  36µs jitter [excellent]
Misc.  system load 1kHz test.....  46µs jitter [excellent]

Overall rating: [excellent]


Other related posts: