Changeset 58047 in webkit


Ignore:
Timestamp:
Apr 21, 2010 8:31:54 PM (14 years ago)
Author:
eric@webkit.org
Message:

2010-04-21 No'am Rosenthal <noam.rosenthal@nokia.com>

Reviewed by Kenneth Rohde Christiansen.

[Qt] QtLauncher: make FPS measurement accurate
https://bugs.webkit.org/show_bug.cgi?id=37934

Instead of counting paints, which are not interchangeable with frames that
the user sees, we now set an arbitrary timer for FPS measurements. The idea is
that if the main thread is delayed for any reason, that timer would be delayed
as well.

  • QtLauncher/QtLauncher.pro:
  • QtLauncher/fpstimer.cpp: Added. (FpsTimer::FpsTimer): (FpsTimer::numFrames): (FpsTimer::start): (FpsTimer::stop): (FpsTimer::timerEvent):
  • QtLauncher/fpstimer.h: Added.
  • QtLauncher/webview.cpp: (WebViewGraphicsBased::setFrameRateMeasurementEnabled): (WebViewGraphicsBased::updateFrameRate): (WebViewGraphicsBased::paintEvent):
  • QtLauncher/webview.h:
Location:
trunk/WebKitTools
Files:
2 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebKitTools/ChangeLog

    r58044 r58047  
     12010-04-21  No'am Rosenthal  <noam.rosenthal@nokia.com>
     2
     3        Reviewed by Kenneth Rohde Christiansen.
     4
     5        [Qt] QtLauncher: make FPS measurement accurate
     6        https://bugs.webkit.org/show_bug.cgi?id=37934
     7
     8        Instead of counting paints, which are not interchangeable with frames that
     9        the user sees, we now set an arbitrary timer for FPS measurements. The idea is
     10        that if the main thread is delayed for any reason, that timer would be delayed
     11        as well.
     12
     13        * QtLauncher/QtLauncher.pro:
     14        * QtLauncher/fpstimer.cpp: Added.
     15        (FpsTimer::FpsTimer):
     16        (FpsTimer::numFrames):
     17        (FpsTimer::start):
     18        (FpsTimer::stop):
     19        (FpsTimer::timerEvent):
     20        * QtLauncher/fpstimer.h: Added.
     21        * QtLauncher/webview.cpp:
     22        (WebViewGraphicsBased::setFrameRateMeasurementEnabled):
     23        (WebViewGraphicsBased::updateFrameRate):
     24        (WebViewGraphicsBased::paintEvent):
     25        * QtLauncher/webview.h:
     26
    1272010-04-21  Eric Seidel  <eric@webkit.org>
    228
  • trunk/WebKitTools/QtLauncher/QtLauncher.pro

    r56636 r58047  
    99    webpage.cpp \
    1010    webview.cpp \
     11    fpstimer.cpp \
    1112
    1213HEADERS += \
     
    1819    webpage.h \
    1920    webview.h \
     21    fpstimer.h \
    2022
    2123CONFIG -= app_bundle
  • trunk/WebKitTools/QtLauncher/webview.cpp

    r56553 r58047  
    107107    if (m_measureFps) {
    108108        m_lastConsultTime = m_startTime = QTime::currentTime();
     109        m_fpsTimer.start();
    109110        m_updateTimer->start();
    110     } else
     111    } else {
     112        m_fpsTimer.stop();
    111113        m_updateTimer->stop();
     114    }
    112115}
    113116
    114117void WebViewGraphicsBased::updateFrameRate()
    115118{
    116     QTime now = QTime::currentTime();
    117 
     119    const QTime now = QTime::currentTime();
    118120    int interval = m_lastConsultTime.msecsTo(now);
    119     int total = m_startTime.msecsTo(now);
    120 
    121     int average = total ? m_numPaintsTotal * 1000 / total : 0;
    122     int current = interval ? m_numPaintsSinceLastMeasure * 1000 / interval : 0;
     121    int frames = m_fpsTimer.numFrames(interval);
     122    int current = interval ? frames * 1000 / interval : 0;
    123123
    124124    emit currentFPSUpdated(current);
    125125
    126126    m_lastConsultTime = now;
    127     m_numPaintsSinceLastMeasure = 0;
    128127}
    129128
     
    157156    if (!m_measureFps)
    158157        return;
    159     m_numPaintsSinceLastMeasure++;
    160     m_numPaintsTotal++;
    161158}
    162159
  • trunk/WebKitTools/QtLauncher/webview.h

    r56553 r58047  
    3434#define webview_h
    3535
     36#include "fpstimer.h"
    3637#include "webpage.h"
    3738#include <qwebview.h>
     
    120121    qreal m_yRotation;
    121122    bool m_resizesToContents;
     123    FpsTimer m_fpsTimer;
    122124};
    123125
Note: See TracChangeset for help on using the changeset viewer.