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

Side by Side Diff: bench/SKPBench.cpp

Issue 1489033004: Began logging more gpu stats from nanobench (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: no gpu support 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 | « bench/SKPBench.h ('k') | bench/nanobench.cpp » ('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 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 for (int j = 0; j < fTileRects.count(); ++j) { 148 for (int j = 0; j < fTileRects.count(); ++j) {
149 const SkMatrix trans = SkMatrix::MakeTrans(-fTileRects[j].fLeft / fScale , 149 const SkMatrix trans = SkMatrix::MakeTrans(-fTileRects[j].fLeft / fScale ,
150 -fTileRects[j].fTop / fScale) ; 150 -fTileRects[j].fTop / fScale) ;
151 fSurfaces[j]->getCanvas()->drawPicture(fPic, &trans, nullptr); 151 fSurfaces[j]->getCanvas()->drawPicture(fPic, &trans, nullptr);
152 } 152 }
153 153
154 for (int j = 0; j < fTileRects.count(); ++j) { 154 for (int j = 0; j < fTileRects.count(); ++j) {
155 fSurfaces[j]->getCanvas()->flush(); 155 fSurfaces[j]->getCanvas()->flush();
156 } 156 }
157 } 157 }
158
159 #if SK_SUPPORT_GPU
160 static void draw_pic_for_stats(SkCanvas* canvas, GrContext* context, const SkPic ture* picture,
161 SkTArray<SkString>* keys, SkTArray<double>* value s,
162 const char* tag) {
163 context->resetGpuStats();
164 canvas->drawPicture(picture);
165 canvas->flush();
166
167 int offset = keys->count();
168 context->dumpGpuStatsKeyValuePairs(keys, values);
169
170 // append tag, but only to new tags
171 for (int i = offset; i < keys->count(); i++, offset++) {
172 (*keys)[i].appendf("_%s", tag);
173 }
174 }
175 #endif
176
177 void SKPBench::getGpuStats(SkCanvas* canvas, SkTArray<SkString>* keys, SkTArray< double>* values) {
178 #if SK_SUPPORT_GPU
179 // we do a special single draw and then dump the key / value pairs
180 GrContext* context = canvas->getGrContext();
181 if (!context) {
182 return;
183 }
184
185 // TODO refactor this out if we want to test other subclasses of skpbench
186 context->flush();
187 context->freeGpuResources();
188 context->resetContext();
189 draw_pic_for_stats(canvas, context, fPic, keys, values, "first_frame");
190
191 // draw second frame
192 draw_pic_for_stats(canvas, context, fPic, keys, values, "second_frame");
193
194 #endif
195 }
OLDNEW
« no previous file with comments | « bench/SKPBench.h ('k') | bench/nanobench.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698