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

Side by Side Diff: bench/SKPBench.cpp

Issue 1495543003: Wire up resource cache stats dumping in nanobench (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix windows warnings Created 5 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
« no previous file with comments | « no previous file | include/gpu/GrContext.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 2014 Google Inc. 2 * Copyright 2014 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 "SKPBench.h" 8 #include "SKPBench.h"
9 #include "SkCommandLineFlags.h" 9 #include "SkCommandLineFlags.h"
10 #include "SkMultiPictureDraw.h" 10 #include "SkMultiPictureDraw.h"
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 #if SK_SUPPORT_GPU 159 #if SK_SUPPORT_GPU
160 static void draw_pic_for_stats(SkCanvas* canvas, GrContext* context, const SkPic ture* picture, 160 static void draw_pic_for_stats(SkCanvas* canvas, GrContext* context, const SkPic ture* picture,
161 SkTArray<SkString>* keys, SkTArray<double>* value s, 161 SkTArray<SkString>* keys, SkTArray<double>* value s,
162 const char* tag) { 162 const char* tag) {
163 context->resetGpuStats(); 163 context->resetGpuStats();
164 canvas->drawPicture(picture); 164 canvas->drawPicture(picture);
165 canvas->flush(); 165 canvas->flush();
166 166
167 int offset = keys->count(); 167 int offset = keys->count();
168 context->dumpGpuStatsKeyValuePairs(keys, values); 168 context->dumpGpuStatsKeyValuePairs(keys, values);
169 context->dumpCacheStatsKeyValuePairs(keys, values);
169 170
170 // append tag, but only to new tags 171 // append tag, but only to new tags
171 for (int i = offset; i < keys->count(); i++, offset++) { 172 for (int i = offset; i < keys->count(); i++, offset++) {
172 (*keys)[i].appendf("_%s", tag); 173 (*keys)[i].appendf("_%s", tag);
173 } 174 }
174 } 175 }
175 #endif 176 #endif
176 177
177 void SKPBench::getGpuStats(SkCanvas* canvas, SkTArray<SkString>* keys, SkTArray< double>* values) { 178 void SKPBench::getGpuStats(SkCanvas* canvas, SkTArray<SkString>* keys, SkTArray< double>* values) {
178 #if SK_SUPPORT_GPU 179 #if SK_SUPPORT_GPU
179 // we do a special single draw and then dump the key / value pairs 180 // we do a special single draw and then dump the key / value pairs
180 GrContext* context = canvas->getGrContext(); 181 GrContext* context = canvas->getGrContext();
181 if (!context) { 182 if (!context) {
182 return; 183 return;
183 } 184 }
184 185
185 // TODO refactor this out if we want to test other subclasses of skpbench 186 // TODO refactor this out if we want to test other subclasses of skpbench
186 context->flush(); 187 context->flush();
187 context->freeGpuResources(); 188 context->freeGpuResources();
188 context->resetContext(); 189 context->resetContext();
189 draw_pic_for_stats(canvas, context, fPic, keys, values, "first_frame"); 190 draw_pic_for_stats(canvas, context, fPic, keys, values, "first_frame");
190 191
191 // draw second frame 192 // draw second frame
192 draw_pic_for_stats(canvas, context, fPic, keys, values, "second_frame"); 193 draw_pic_for_stats(canvas, context, fPic, keys, values, "second_frame");
193 194
194 #endif 195 #endif
195 } 196 }
OLDNEW
« no previous file with comments | « no previous file | include/gpu/GrContext.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698