Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-8939

consider making server not use sleepmicros()

    • Type: Icon: Improvement Improvement
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Concurrency
    • Labels:
      None

      sleepmicros() is misleading as the resolution can be very low on most operating systems. a quick test on linux yielded the results below. on windows it is even more coarse-grained always taking close to 1ms if the parameter is non-zero.

      left is requested micros, right is actual

      sleep 0 time: 1
      sleep 1 time: 98
      sleep 3 time: 71
      sleep 7 time: 65
      sleep 15 time: 72
      sleep 31 time: 88
      sleep 63 time: 120
      sleep 127 time: 187
      sleep 255 time: 314
      sleep 511 time: 596
      sleep 1023 time: 1131
      sleep 2047 time: 2140
      sleep 4095 time: 4188
      

            Assignee:
            Unassigned Unassigned
            Reporter:
            dwight@mongodb.com Dwight Merriman
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: