Re: [RFC/RFT] calloutng

From: Ian Lepore <ian_at_FreeBSD.org>
Date: Thu, 17 Jan 2013 09:05:47 -0700
On Sun, 2012-12-30 at 16:13 -0700, Ian Lepore wrote:
> On Wed, 2012-12-26 at 21:24 +0200, Alexander Motin wrote:
> >[...]
> > 
> 
> I grabbed testsleep.c to test an arm event timer implementation, and had
> to fix a couple nits... kqueueto was missing from the names[] array, and
> I had to add a "* 1000" to a couple places where usec was stuffed into a
> timespec's tv_nsec.
> 
> I also tested the calloutng_12_17 patches and the kqueue stuff behaved
> very strangely.  Then I noticed you had a 12_26 patchset so I tested
> that (after crudely fixing a couple uninitialized var warnings), and it
> all looks good on this arm (Raspberry Pi).  I'll attach the results.
> 
> It's so sweet to be able to do precision sleeps.
> 
> -- Ian
> 
> 
> plain text document attachment (calloutng_test.txt)
> for t in 1 300 3000 30000 300000 ; do
>   for m in select poll usleep nanosleep kqueue kqueueto syscall ; do
>     ./testsleep $t $m
>   done
> done
> 
> 
> With calloutng_12_26.patch...
> 
>                 HZ=100               HZ=250               HZ=1000
> ---------- ----------------     ----------------     ----------------
> select          1     55.79          1     50.96          1     61.32
> poll            1   1109.46          1   1107.86          1   1114.38
> usleep          1     56.33          1     72.90          1     62.78
> nanosleep       1     52.66          1     55.23          1     64.23
> kqueue          1   1114.23          1   1113.81          1   1121.21
> kqueueto        1     65.44          1     71.00          1     75.01
> syscall         1      4.70          1      4.45          1      4.55
> select        300    355.79        300    357.76        300    362.35
> poll          300   1107.85        300   1122.55        300   1115.62
> usleep        300    355.28        300    357.28        300    360.79
> nanosleep     300    354.49        300    355.82        300    360.62
> kqueue        300   1112.57        300   1118.13        300   1117.16
> kqueueto      300    375.98        300    378.62        300    395.61
> syscall       300      4.41        300      4.45        300      4.54
> select       3000   3246.75       3000   3246.74       3000   3252.72
> poll         3000   3238.10       3000   3229.12       3000   3250.10
> usleep       3000   3242.47       3000   3237.06       3000   3249.61
> nanosleep    3000   3238.79       3000   3231.55       3000   3248.11
> kqueue       3000   3240.01       3000   3236.07       3000   3247.60
> kqueueto     3000   3265.36       3000   3267.22       3000   3274.96
> syscall      3000      4.69       3000      4.44       3000      4.50
> select      30000  31714.60      30000  31941.17      30000  32467.69
> poll        30000  31522.76      30000  31983.00      30000  32497.81
> usleep      30000  31459.67      30000  31980.76      30000  32458.71
> nanosleep   30000  31431.02      30000  31982.22      30000  32525.20
> kqueue      30000  31466.75      30000  31873.90      30000  31973.54
> kqueueto    30000  31564.67      30000  32522.35      30000  32475.59
> syscall     30000      4.70      30000      4.73      30000      4.89
> select     300000 319133.02     300000 311562.33     300000 309918.62
> poll       300000 319604.27     300000 311422.94     300000 310000.76
> usleep     300000 319314.60     300000 311269.69     300000 309996.34
> nanosleep  300000 319497.58     300000 311425.40     300000 309997.13
> kqueue     300000 309995.55     300000 303980.27     300000 309908.82
> kqueueto   300000 319505.88     300000 311424.97     300000 309996.16
> syscall    300000      4.41     300000      4.45     300000      4.89
>            
> 
> With no patches...
> 
>                 HZ=100               HZ=250               HZ=1000
> ---------- ----------------     ----------------     ----------------
> select          1  19941.70          1   7989.10          1   1999.16
> poll            1  19904.61          1   7987.32          1   1999.78
> usleep          1  19904.95          1   7993.30          1   1999.96
> nanosleep       1  19905.64          1   7993.71          1   1999.72
> kqueue          1  10001.61          1   4004.00          1   1000.27
> kqueueto        1  19904.00          1   7993.03          1   1999.54
> syscall         1      4.04          1      4.05          1      4.75
> select        300  19904.66        300   7998.39        300   2000.27
> poll          300  19904.35        300   7993.47        300   1999.86
> usleep        300  19903.96        300   7994.11        300   1999.81
> nanosleep     300  19904.48        300   7993.77        300   1999.80
> kqueue        300  10001.68        300   4004.18        300   1000.31
> kqueueto      300  19997.86        300   7993.37        300   1999.59
> syscall       300      4.01        300      4.00        300      4.32
> select       3000  19904.80       3000   7998.85       3000   3998.43
> poll         3000  19904.92       3000   8005.93       3000   3999.39
> usleep       3000  19904.50       3000   7992.88       3000   3999.44
> nanosleep    3000  19904.84       3000   7993.34       3000   3999.36
> kqueue       3000  10001.58       3000   4003.97       3000   3000.72
> kqueueto     3000  19903.56       3000   7993.24       3000   3999.34
> syscall      3000      4.02       3000      4.37       3000      4.29
> select      30000  39905.02      30000  35991.79      30000  31051.77
> poll        30000  39905.49      30000  35980.35      30000  30995.64
> usleep      30000  39903.78      30000  35979.48      30000  30995.23
> nanosleep   30000  39904.55      30000  35981.61      30000  30995.87
> kqueue      30000  30002.73      30000  32019.54      30000  30004.83
> kqueueto    30000  39903.59      30000  35979.64      30000  30996.05
> syscall     30000      4.44      30000      4.04      30000      4.31
> select     300000 310001.23     300000 303995.86     300000 300994.30
> poll       300000 309902.73     300000 303981.58     300000 300996.17
> usleep     300000 309903.64     300000 303980.17     300000 300997.42
> nanosleep  300000 309903.32     300000 303980.36     300000 300993.64
> kqueue     300000 300002.77     300000 300019.46     300000 300006.90
> kqueueto   300000 309903.31     300000 303978.10     300000 300996.84
> syscall    300000      4.01     300000      4.04     300000      4.29

Davide asked me in a private followup (long ago) to try the same test
with linux running on the same hardware.  I finally got around to
downloading a linux image for the Raspberry Pi today and did so.  The
image I used was

  2012-12-16-wheezy-raspbian.zip
  SHA-1 514974a5fcbbbea02151d79a715741c2159d4b0a

The test code was the same as last time, except for commenting out the
kqueue stuff.  Here are the results...

     1     79.80  select
     1   1077.37  poll
     1     74.87  usleep
     1     74.83  nanosleep
     1      0.00  <no linux kqueue>
     1      0.00  <no linux kqueue>
     1      0.87  syscall
   300    379.89  select
   300   1077.70  poll
   300    374.97  usleep
   300    374.75  nanosleep
   300      0.00  <no linux kqueue>
   300      0.00  <no linux kqueue>
   300      0.85  syscall
  3000   3085.27  select
  3000   3081.32  poll
  3000   3081.20  usleep
  3000   3081.06  nanosleep
  3000      0.00  <no linux kqueue>
  3000      0.00  <no linux kqueue>
  3000      0.88  syscall
 30000  30093.14  select
 30000  30090.79  poll
 30000  30090.05  usleep
 30000  30088.43  nanosleep
 30000      0.00  <no linux kqueue>
 30000      0.00  <no linux kqueue>
 30000      0.86  syscall
300000 300351.35  select
300000 300346.16  poll
300000 300097.34  usleep
300000 300097.29  nanosleep
300000      0.00  <no linux kqueue>
300000      0.00  <no linux kqueue>
300000      0.85  syscall

-- Ian
Received on Thu Jan 17 2013 - 15:05:51 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:40:34 UTC