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

consider making server not use sleepmicros()

    XMLWordPrintable

    Details

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

      Description

      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

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              dwight_10gen Dwight Merriman
              Participants:
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: