Changeset 54222 in webkit
- Timestamp:
- Feb 2, 2010 3:38:21 AM (14 years ago)
- Location:
- trunk/WebKit/qt
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebKit/qt/ChangeLog
r54069 r54222 1 2010-02-02 Noam Rosenthal <noam.rosenthal@nokia.com> 2 3 Reviewed by Kenneth Rohde Christiansen. 4 5 [Qt] Enable a way to measure FPS in QGVLauncher 6 run QGVLauncher with --show-fps to see ongoing fps measurements 7 This is not meant as accurate FPS, but rather as a way to find 8 improvements/regressions 9 https://bugs.webkit.org/show_bug.cgi?id=34450 10 11 * QGVLauncher/main.cpp: 12 (MainView::MainView): initialize FPS values 13 (MainView::paintEvent): count a painted frame here 14 (MainView::printFps): we print the fps with qDebug every 5 seconds. 15 1 16 2010-01-29 Ben Murdoch <benm@google.com> 2 17 -
trunk/WebKit/qt/QGVLauncher/main.cpp
r53698 r54222 126 126 : QGraphicsView(parent) 127 127 , m_mainWidget(0) 128 , m_measureFps(QApplication::instance()->arguments().contains("--show-fps")) 129 , m_numTotalPaints(0) 130 , m_numPaintsSinceLastMeasure(0) 128 131 { 129 132 setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); … … 132 135 setFrameShape(QFrame::NoFrame); 133 136 setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); 137 if (m_measureFps) { 138 QTimer* fpsTimer = new QTimer(this); 139 fpsTimer->setInterval(5000); 140 m_totalStartTime = m_startTime = QTime::currentTime(); 141 connect(fpsTimer, SIGNAL(timeout()), this, SLOT(printFps())); 142 fpsTimer->start(); 143 } 134 144 } 135 145 … … 150 160 } 151 161 162 void paintEvent(QPaintEvent* event) 163 { 164 QGraphicsView::paintEvent(event); 165 if (m_measureFps) { 166 ++m_numPaintsSinceLastMeasure; 167 ++m_numTotalPaints; 168 } 169 } 170 152 171 void setWaitCursor() 153 172 { … … 196 215 } 197 216 217 void printFps() 218 { 219 // note that this might have a bug if you measure right around midnight, but we can live with that 220 QTime now = QTime::currentTime(); 221 int msecs = m_startTime.msecsTo(now); 222 int totalMsecs = m_totalStartTime.msecsTo(now); 223 int totalFps = totalMsecs ? m_numTotalPaints * 1000 / totalMsecs : 0; 224 int curFps = msecs ? m_numPaintsSinceLastMeasure * 1000 / msecs : 0; 225 qDebug("[FPS] From start: %d, from last paint: %d", totalFps, curFps); 226 m_startTime = now; 227 m_numPaintsSinceLastMeasure = 0; 228 } 229 198 230 signals: 199 231 void flipRequest(); … … 201 233 private: 202 234 QGraphicsWidget* m_mainWidget; 235 bool m_measureFps; 236 int m_numTotalPaints; 237 int m_numPaintsSinceLastMeasure; 238 QTime m_startTime; 239 QTime m_totalStartTime; 203 240 }; 204 241
Note: See TracChangeset
for help on using the changeset viewer.