Changeset 58047 in webkit
- Timestamp:
- Apr 21, 2010 8:31:54 PM (14 years ago)
- Location:
- trunk/WebKitTools
- Files:
-
- 2 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebKitTools/ChangeLog
r58044 r58047 1 2010-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 1 27 2010-04-21 Eric Seidel <eric@webkit.org> 2 28 -
trunk/WebKitTools/QtLauncher/QtLauncher.pro
r56636 r58047 9 9 webpage.cpp \ 10 10 webview.cpp \ 11 fpstimer.cpp \ 11 12 12 13 HEADERS += \ … … 18 19 webpage.h \ 19 20 webview.h \ 21 fpstimer.h \ 20 22 21 23 CONFIG -= app_bundle -
trunk/WebKitTools/QtLauncher/webview.cpp
r56553 r58047 107 107 if (m_measureFps) { 108 108 m_lastConsultTime = m_startTime = QTime::currentTime(); 109 m_fpsTimer.start(); 109 110 m_updateTimer->start(); 110 } else 111 } else { 112 m_fpsTimer.stop(); 111 113 m_updateTimer->stop(); 114 } 112 115 } 113 116 114 117 void WebViewGraphicsBased::updateFrameRate() 115 118 { 116 QTime now = QTime::currentTime(); 117 119 const QTime now = QTime::currentTime(); 118 120 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; 123 123 124 124 emit currentFPSUpdated(current); 125 125 126 126 m_lastConsultTime = now; 127 m_numPaintsSinceLastMeasure = 0;128 127 } 129 128 … … 157 156 if (!m_measureFps) 158 157 return; 159 m_numPaintsSinceLastMeasure++;160 m_numPaintsTotal++;161 158 } 162 159 -
trunk/WebKitTools/QtLauncher/webview.h
r56553 r58047 34 34 #define webview_h 35 35 36 #include "fpstimer.h" 36 37 #include "webpage.h" 37 38 #include <qwebview.h> … … 120 121 qreal m_yRotation; 121 122 bool m_resizesToContents; 123 FpsTimer m_fpsTimer; 122 124 }; 123 125
Note: See TracChangeset
for help on using the changeset viewer.