<html>
    <head>
      <base href="https://bugs.webkit.org/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Windows system timer resolution needlessly cranked up when nextFireTime is in the past"
   href="https://bugs.webkit.org/show_bug.cgi?id=153042">153042</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Windows system timer resolution needlessly cranked up when nextFireTime is in the past
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>WebKit
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>WebKit Nightly Build
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Windows 7
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>Normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P2
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Platform
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>webkit-unassigned&#64;lists.webkit.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>jnlehner&#64;yahoo.com
          </td>
        </tr></table>
      <p>
        <div>
        <pre>In <a href="http://trac.webkit.org/browser/trunk/Source/WebCore/platform/win/MainThreadSharedTimerWin.cpp">http://trac.webkit.org/browser/trunk/Source/WebCore/platform/win/MainThreadSharedTimerWin.cpp</a>

if MainThreadSharedTimer::setFireInterval() is called with an interval of 0, as will happen when ThreadTimers::updateSharedTimer() executes

m_sharedTimer-&gt;setFireInterval(std::max(nextFireTime - currentMonotonicTime, 0.0));

with nextFireTime in the past, then the following executes:

138    if (Settings::shouldUseHighResolutionTimers()) {
139            if (interval &lt; highResolutionThresholdMsec) {
140                if (!highResTimerActive) {
141                    highResTimerActive = true;
142                    timeBeginPeriod(timerResolution);
143                }

highResolutionThresholdMsec is 16, so 0 &lt; 16 and we call timeBeginPeriod(1) which stays in effect ~1/3 of a second.  This increases power consumption needlessly.

We should only increase the system timer resolution if we're going to actually proceed to the CreateTimerQueueTimer() call; if we're going to PostMessage() immediately no resolution increase is necessary.</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>