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

Unified Diff: bench/nanobench.h

Issue 1029423010: Android HWUI backend Nanobench (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: More SK_OVERRIDE vs override racing Created 5 years, 9 months 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/Benchmark.h ('k') | bench/nanobench.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: bench/nanobench.h
diff --git a/bench/nanobench.h b/bench/nanobench.h
new file mode 100644
index 0000000000000000000000000000000000000000..a38b5f577248218d752ec804b368638a8af2b043
--- /dev/null
+++ b/bench/nanobench.h
@@ -0,0 +1,79 @@
+/*
+ * Copyright 2015 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef nanobench_DEFINED
+#define nanobench_DEFINED
+
+#include "Benchmark.h"
+#include "SkImageInfo.h"
+#include "SkSurface.h"
+#include "SkTypes.h"
+
+#if SK_SUPPORT_GPU
+#include "GrContextFactory.h"
+#endif
+
+class ResultsWriter;
+class SkBitmap;
+class SkCanvas;
+
+struct Config {
+ const char* name;
+ Benchmark::Backend backend;
+ SkColorType color;
+ SkAlphaType alpha;
+ int samples;
+#if SK_SUPPORT_GPU
+ GrContextFactory::GLContextType ctxType;
+ bool useDFText;
+#else
+ int bogusInt;
+ bool bogusBool;
+#endif
+};
+
+struct Target {
+ explicit Target(const Config& c) : config(c) { }
+ virtual ~Target() { }
+
+ const Config config;
+ SkAutoTDelete<SkSurface> surface;
+
+ /** Called once per target, immediately before any timing or drawing. */
+ virtual void setup() { }
+
+ /** Called *after* the clock timer is started, before the benchmark
+ is drawn. */
+ virtual SkCanvas* beginTiming(SkCanvas* canvas) { return canvas; }
+
+ /** Called *after* a benchmark is drawn, but before the clock timer
+ is stopped. */
+ virtual void endTiming() { }
+
+ /** Called between benchmarks (or between calibration and measured
+ runs) to make sure all pending work in drivers / threads is
+ complete. */
+ virtual void fence() { }
+
+ /** CPU-like targets can just be timed, but GPU-like
+ targets need to pay attention to frame boundaries
+ or other similar details. */
+ virtual bool needsFrameTiming() const { return false; }
+
+ /** Called once per target, during program initialization.
+ Returns false if initialization fails. */
+ virtual bool init(SkImageInfo info, Benchmark* bench);
+
+ /** Stores any pixels drawn to the screen in the bitmap.
+ Returns false on error. */
+ virtual bool capturePixels(SkBitmap* bmp);
+
+ /** Writes any config-specific data to the log. */
+ virtual void fillOptions(ResultsWriter*) { }
+};
+
+#endif // nanobench_DEFINED
« no previous file with comments | « bench/Benchmark.h ('k') | bench/nanobench.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698