OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "SkBenchLogger.h" | 8 #include "SkBenchLogger.h" |
9 #include "BenchTimer.h" | 9 #include "BenchTimer.h" |
10 #include "PictureBenchmark.h" | 10 #include "PictureBenchmark.h" |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 | 163 |
164 configName.append(" <averaged>"); | 164 configName.append(" <averaged>"); |
165 SkString longRunningResult = longRunningTimerData.getResult( | 165 SkString longRunningResult = longRunningTimerData.getResult( |
166 tiledRenderer->getNormalTimeFormat().c_str(), | 166 tiledRenderer->getNormalTimeFormat().c_str(), |
167 TimerData::kAvg_Result, | 167 TimerData::kAvg_Result, |
168 configName.c_str(), timerTypes, fRepeats); | 168 configName.c_str(), timerTypes, fRepeats); |
169 longRunningResult.append("\n"); | 169 longRunningResult.append("\n"); |
170 this->logProgress(longRunningResult.c_str()); | 170 this->logProgress(longRunningResult.c_str()); |
171 } | 171 } |
172 } else { | 172 } else { |
173 SkAutoTDelete<BenchTimer> timer(this->setupTimer()); | 173 SkAutoTDelete<BenchTimer> longRunningTimer(this->setupTimer()); |
174 TimerData timerData(fRepeats); | 174 TimerData longRunningTimerData(1); |
| 175 SkAutoTDelete<BenchTimer> perRunTimer(this->setupTimer(false)); |
| 176 TimerData perRunTimerData(fRepeats); |
| 177 |
| 178 longRunningTimer->start(); |
175 for (int i = 0; i < fRepeats; ++i) { | 179 for (int i = 0; i < fRepeats; ++i) { |
176 fRenderer->setup(); | 180 fRenderer->setup(); |
177 | 181 |
178 timer->start(); | 182 perRunTimer->start(); |
179 fRenderer->render(NULL); | 183 fRenderer->render(NULL); |
180 timer->truncatedEnd(); | 184 perRunTimer->truncatedEnd(); |
| 185 fRenderer->resetState(false); |
| 186 perRunTimer->end(); |
181 | 187 |
182 // Finishes gl context | 188 SkAssertResult(perRunTimerData.appendTimes(perRunTimer.get())); |
183 fRenderer->resetState(true); | |
184 timer->end(); | |
185 | |
186 SkAssertResult(timerData.appendTimes(timer.get())); | |
187 } | 189 } |
| 190 longRunningTimer->truncatedEnd(); |
| 191 fRenderer->resetState(true); |
| 192 longRunningTimer->end(); |
| 193 SkAssertResult(longRunningTimerData.appendTimes(longRunningTimer.get()))
; |
188 | 194 |
189 SkString configName = fRenderer->getConfigName(); | 195 SkString configName = fRenderer->getConfigName(); |
190 | 196 |
191 SkString result = timerData.getResult(timeFormat.c_str(), | 197 // Beware - since the per-run-timer doesn't ever include a glFinish it c
an |
192 fTimerResult, | 198 // report a lower time then the long-running-timer |
193 configName.c_str(), | 199 #if 0 |
194 timerTypes); | 200 SkString result = perRunTimerData.getResult(timeFormat.c_str(), |
| 201 fTimerResult, |
| 202 configName.c_str(), |
| 203 timerTypes); |
| 204 result.append("\n"); |
| 205 |
| 206 this->logProgress(result.c_str()); |
| 207 #else |
| 208 SkString result = longRunningTimerData.getResult(timeFormat.c_str(), |
| 209 fTimerResult, |
| 210 configName.c_str(), |
| 211 timerTypes, |
| 212 fRepeats); |
195 result.append("\n"); | 213 result.append("\n"); |
196 this->logProgress(result.c_str()); | 214 this->logProgress(result.c_str()); |
| 215 #endif |
197 } | 216 } |
198 | 217 |
199 fRenderer->end(); | 218 fRenderer->end(); |
200 } | 219 } |
201 | 220 |
202 } | 221 } |
OLD | NEW |