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

Unified 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: minor tweak 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « bench/SKPBench.h ('k') | bench/nanobench.cpp » ('j') | bench/nanobench.cpp » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: bench/SKPBench.cpp
diff --git a/bench/SKPBench.cpp b/bench/SKPBench.cpp
index 910af6b802337a700557f1ceedc24ab5a1375458..806f8ad9507aa8a22f60bcd4e95bb4eb9b2c984c 100644
--- a/bench/SKPBench.cpp
+++ b/bench/SKPBench.cpp
@@ -155,3 +155,39 @@ void SKPBench::drawPicture() {
fSurfaces[j]->getCanvas()->flush();
}
}
+
+static void draw_pic(SkCanvas* canvas, GrContext* context, const SkPicture* picture,
bsalomon 2015/12/02 15:44:26 draw_pic_for_stats? Does offset need to be a para
joshualitt 2015/12/02 15:53:05 Acknowledged.
+ SkTArray<SkString>* keys, SkTArray<double>* values, const char* tag,
+ int* offset) {
+ canvas->drawPicture(picture);
+ canvas->flush();
+ context->dumpGpuStatsKeyValuePairs(keys, values);
+
+ // append tag, but only to keys >= offset
+ for (int i = *offset; i < keys->count(); i++, (*offset)++) {
+ (*keys)[i].appendf("_%s", tag);
+ }
+ context->resetGpuStats();
+}
+
+void SKPBench::getGpuStats(SkCanvas* canvas, SkTArray<SkString>* keys, SkTArray<double>* values) {
+#if SK_SUPPORT_GPU
+ // we do a special single draw and then dump the key / value pairs
+ GrContext* context = canvas->getGrContext();
+ if (!context) {
+ return;
+ }
+
+ // TODO refactor this out if we want to test other subclasses of skpbench
+ int offset = 0;
+ context->flush();
+ context->freeGpuResources();
+ context->resetContext();
+ context->resetGpuStats();
bsalomon 2015/12/02 15:44:26 maybe make draw_pic reset stats before calling dra
joshualitt 2015/12/02 15:53:05 Acknowledged.
+ draw_pic(canvas, context, fPic, keys, values, "first_frame", &offset);
+
+ // draw second frame
+ draw_pic(canvas, context, fPic, keys, values, "second_frame", &offset);
+
+#endif
+}
« no previous file with comments | « bench/SKPBench.h ('k') | bench/nanobench.cpp » ('j') | bench/nanobench.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698