Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(44)

Side by Side Diff: tools/PictureBenchmark.cpp

Issue 117583002: Update bench pictures to time image decode & upload costs (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Fixed comment Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « tools/PictureBenchmark.h ('k') | tools/PictureRenderer.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
11 #include "SkCanvas.h" 11 #include "SkCanvas.h"
12 #include "SkPicture.h" 12 #include "SkPicture.h"
13 #include "SkString.h" 13 #include "SkString.h"
14 #include "picture_utils.h" 14 #include "picture_utils.h"
15 15
16 namespace sk_tools { 16 namespace sk_tools {
17 17
18 PictureBenchmark::PictureBenchmark() 18 PictureBenchmark::PictureBenchmark()
19 : fRepeats(1) 19 : fRepeats(1)
20 , fLogger(NULL) 20 , fLogger(NULL)
21 , fRenderer(NULL) 21 , fRenderer(NULL)
22 , fTimerResult(TimerData::kAvg_Result) 22 , fTimerResult(TimerData::kAvg_Result)
23 , fTimerTypes(0) 23 , fTimerTypes(0)
24 , fTimeIndividualTiles(false) 24 , fTimeIndividualTiles(false)
25 , fPurgeDecodedTex(false)
25 {} 26 {}
26 27
27 PictureBenchmark::~PictureBenchmark() { 28 PictureBenchmark::~PictureBenchmark() {
28 SkSafeUnref(fRenderer); 29 SkSafeUnref(fRenderer);
29 } 30 }
30 31
31 void PictureBenchmark::setTimersToShow(bool wall, 32 void PictureBenchmark::setTimersToShow(bool wall,
32 bool truncatedWall, 33 bool truncatedWall,
33 bool cpu, 34 bool cpu,
34 bool truncatedCpu, 35 bool truncatedCpu,
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 return; 73 return;
73 } 74 }
74 75
75 fRenderer->init(pict); 76 fRenderer->init(pict);
76 77
77 // We throw this away to remove first time effects (such as paging in this p rogram) 78 // We throw this away to remove first time effects (such as paging in this p rogram)
78 fRenderer->setup(); 79 fRenderer->setup();
79 fRenderer->render(NULL); 80 fRenderer->render(NULL);
80 fRenderer->resetState(true); 81 fRenderer->resetState(true);
81 82
83 if (fPurgeDecodedTex) {
84 fRenderer->purgeTextures();
85 }
86
82 bool usingGpu = false; 87 bool usingGpu = false;
83 #if SK_SUPPORT_GPU 88 #if SK_SUPPORT_GPU
84 usingGpu = fRenderer->isUsingGpuDevice(); 89 usingGpu = fRenderer->isUsingGpuDevice();
85 #endif 90 #endif
86 91
87 uint32_t timerTypes = fTimerTypes; 92 uint32_t timerTypes = fTimerTypes;
88 if (!usingGpu) { 93 if (!usingGpu) {
89 timerTypes &= ~TimerData::kGpu_Flag; 94 timerTypes &= ~TimerData::kGpu_Flag;
90 } 95 }
91 96
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 SkAutoTDelete<BenchTimer> perTileTimer(this->setupTimer(false)); 138 SkAutoTDelete<BenchTimer> perTileTimer(this->setupTimer(false));
134 TimerData perTileTimerData(fRepeats); 139 TimerData perTileTimerData(fRepeats);
135 longRunningTimer->start(); 140 longRunningTimer->start();
136 for (int i = 0; i < fRepeats; ++i) { 141 for (int i = 0; i < fRepeats; ++i) {
137 perTileTimer->start(); 142 perTileTimer->start();
138 tiledRenderer->drawCurrentTile(); 143 tiledRenderer->drawCurrentTile();
139 perTileTimer->truncatedEnd(); 144 perTileTimer->truncatedEnd();
140 tiledRenderer->resetState(false); 145 tiledRenderer->resetState(false);
141 perTileTimer->end(); 146 perTileTimer->end();
142 SkAssertResult(perTileTimerData.appendTimes(perTileTimer.get())) ; 147 SkAssertResult(perTileTimerData.appendTimes(perTileTimer.get())) ;
148
149 if (fPurgeDecodedTex) {
150 fRenderer->purgeTextures();
151 }
143 } 152 }
144 longRunningTimer->truncatedEnd(); 153 longRunningTimer->truncatedEnd();
145 tiledRenderer->resetState(true); 154 tiledRenderer->resetState(true);
146 longRunningTimer->end(); 155 longRunningTimer->end();
147 SkAssertResult(longRunningTimerData.appendTimes(longRunningTimer.get ())); 156 SkAssertResult(longRunningTimerData.appendTimes(longRunningTimer.get ()));
148 157
149 SkString configName = tiledRenderer->getConfigName(); 158 SkString configName = tiledRenderer->getConfigName();
150 configName.appendf(": tile [%i,%i] out of [%i,%i]", x, y, xTiles, yT iles); 159 configName.appendf(": tile [%i,%i] out of [%i,%i]", x, y, xTiles, yT iles);
151 160
152 SkString result = perTileTimerData.getResult(timeFormat.c_str(), fTi merResult, 161 SkString result = perTileTimerData.getResult(timeFormat.c_str(), fTi merResult,
153 configName.c_str(), tim erTypes); 162 configName.c_str(), tim erTypes);
154 result.append("\n"); 163 result.append("\n");
155 164
156 // TODO(borenet): Turn off per-iteration tile time reporting for now. Avoiding logging the time 165 // TODO(borenet): Turn off per-iteration tile time reporting for now. Avoiding logging the time
157 // for every iteration for each tile cuts down on data file size by a significan t amount. Re-enable 166 // for every iteration for each tile cuts down on data file size by a significan t amount. Re-enable
158 // this once we're loading the bench data directly into a data store and are no longer generating 167 // this once we're loading the bench data directly into a data store and are no longer generating
159 // SVG graphs. 168 // SVG graphs.
160 #if 0 169 #if 0
161 this->logProgress(result.c_str()); 170 this->logProgress(result.c_str());
162 #endif 171 #endif
163 172 if (fPurgeDecodedTex) {
173 configName.append(" <withPurging>");
174 }
164 configName.append(" <averaged>"); 175 configName.append(" <averaged>");
165 SkString longRunningResult = longRunningTimerData.getResult( 176 SkString longRunningResult = longRunningTimerData.getResult(
166 tiledRenderer->getNormalTimeFormat().c_str(), 177 tiledRenderer->getNormalTimeFormat().c_str(),
167 TimerData::kAvg_Result, 178 TimerData::kAvg_Result,
168 configName.c_str(), timerTypes, fRepeats); 179 configName.c_str(), timerTypes, fRepeats);
169 longRunningResult.append("\n"); 180 longRunningResult.append("\n");
170 this->logProgress(longRunningResult.c_str()); 181 this->logProgress(longRunningResult.c_str());
171 } 182 }
172 } else { 183 } else {
173 SkAutoTDelete<BenchTimer> longRunningTimer(this->setupTimer()); 184 SkAutoTDelete<BenchTimer> longRunningTimer(this->setupTimer());
174 TimerData longRunningTimerData(1); 185 TimerData longRunningTimerData(1);
175 SkAutoTDelete<BenchTimer> perRunTimer(this->setupTimer(false)); 186 SkAutoTDelete<BenchTimer> perRunTimer(this->setupTimer(false));
176 TimerData perRunTimerData(fRepeats); 187 TimerData perRunTimerData(fRepeats);
177 188
178 longRunningTimer->start(); 189 longRunningTimer->start();
179 for (int i = 0; i < fRepeats; ++i) { 190 for (int i = 0; i < fRepeats; ++i) {
180 fRenderer->setup(); 191 fRenderer->setup();
181 192
182 perRunTimer->start(); 193 perRunTimer->start();
183 fRenderer->render(NULL); 194 fRenderer->render(NULL);
184 perRunTimer->truncatedEnd(); 195 perRunTimer->truncatedEnd();
185 fRenderer->resetState(false); 196 fRenderer->resetState(false);
186 perRunTimer->end(); 197 perRunTimer->end();
187 198
188 SkAssertResult(perRunTimerData.appendTimes(perRunTimer.get())); 199 SkAssertResult(perRunTimerData.appendTimes(perRunTimer.get()));
200
201 if (fPurgeDecodedTex) {
202 fRenderer->purgeTextures();
203 }
189 } 204 }
190 longRunningTimer->truncatedEnd(); 205 longRunningTimer->truncatedEnd();
191 fRenderer->resetState(true); 206 fRenderer->resetState(true);
192 longRunningTimer->end(); 207 longRunningTimer->end();
193 SkAssertResult(longRunningTimerData.appendTimes(longRunningTimer.get())) ; 208 SkAssertResult(longRunningTimerData.appendTimes(longRunningTimer.get())) ;
194 209
195 SkString configName = fRenderer->getConfigName(); 210 SkString configName = fRenderer->getConfigName();
211 if (fPurgeDecodedTex) {
212 configName.append(" <withPurging>");
213 }
196 214
197 // Beware - since the per-run-timer doesn't ever include a glFinish it c an 215 // Beware - since the per-run-timer doesn't ever include a glFinish it c an
198 // report a lower time then the long-running-timer 216 // report a lower time then the long-running-timer
199 #if 0 217 #if 0
200 SkString result = perRunTimerData.getResult(timeFormat.c_str(), 218 SkString result = perRunTimerData.getResult(timeFormat.c_str(),
201 fTimerResult, 219 fTimerResult,
202 configName.c_str(), 220 configName.c_str(),
203 timerTypes); 221 timerTypes);
204 result.append("\n"); 222 result.append("\n");
205 223
206 this->logProgress(result.c_str()); 224 this->logProgress(result.c_str());
207 #else 225 #else
208 SkString result = longRunningTimerData.getResult(timeFormat.c_str(), 226 SkString result = longRunningTimerData.getResult(timeFormat.c_str(),
209 fTimerResult, 227 fTimerResult,
210 configName.c_str(), 228 configName.c_str(),
211 timerTypes, 229 timerTypes,
212 fRepeats); 230 fRepeats);
213 result.append("\n"); 231 result.append("\n");
214 this->logProgress(result.c_str()); 232 this->logProgress(result.c_str());
215 #endif 233 #endif
216 } 234 }
217 235
218 fRenderer->end(); 236 fRenderer->end();
219 } 237 }
220 238
221 } 239 }
OLDNEW
« no previous file with comments | « tools/PictureBenchmark.h ('k') | tools/PictureRenderer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698