aboutsummaryrefslogtreecommitdiffhomepage
path: root/bench/RegionBench.cpp
diff options
context:
space:
mode:
authorGravatar mtklein@google.com <mtklein@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-09-10 19:23:38 +0000
committerGravatar mtklein@google.com <mtklein@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-09-10 19:23:38 +0000
commitc289743864e2ab926a95e617a5cd1d29b26d1825 (patch)
tree2c559da19185181efd8bd92791fb758af5969800 /bench/RegionBench.cpp
parent55ebe8eca0063ab1f3979d629749bc41ec409ac1 (diff)
Major bench refactoring.
- Use FLAGS_. - Remove outer repeat loop. - Tune inner loop automatically. BUG=skia:1590 R=epoger@google.com, scroggo@google.com Review URL: https://codereview.chromium.org/23478013 git-svn-id: http://skia.googlecode.com/svn/trunk@11187 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'bench/RegionBench.cpp')
-rw-r--r--bench/RegionBench.cpp14
1 files changed, 5 insertions, 9 deletions
diff --git a/bench/RegionBench.cpp b/bench/RegionBench.cpp
index 7a306e97c3..ffd674a881 100644
--- a/bench/RegionBench.cpp
+++ b/bench/RegionBench.cpp
@@ -74,12 +74,10 @@ public:
SkRegion fA, fB;
Proc fProc;
SkString fName;
- int fLoopMul;
enum {
W = 1024,
H = 768,
- N = SkBENCHLOOP(2000)
};
SkIRect randrect(SkRandom& rand) {
@@ -90,10 +88,9 @@ public:
return SkIRect::MakeXYWH(x, y, w >> 1, h >> 1);
}
- RegionBench(void* param, int count, Proc proc, const char name[], int mul = 1) : INHERITED(param) {
+ RegionBench(void* param, int count, Proc proc, const char name[]) : INHERITED(param) {
fProc = proc;
fName.printf("region_%s_%d", name, count);
- fLoopMul = mul;
SkRandom rand;
for (int i = 0; i < count; i++) {
@@ -108,8 +105,7 @@ protected:
virtual void onDraw(SkCanvas* canvas) {
Proc proc = fProc;
- int n = fLoopMul * N;
- for (int i = 0; i < n; ++i) {
+ for (int i = 0; i < this->getLoops(); ++i) {
proc(fA, fB);
}
}
@@ -125,9 +121,9 @@ static SkBenchmark* gF1(void* p) { return SkNEW_ARGS(RegionBench, (p, SMALL, sec
static SkBenchmark* gF2(void* p) { return SkNEW_ARGS(RegionBench, (p, SMALL, diff_proc, "difference")); }
static SkBenchmark* gF3(void* p) { return SkNEW_ARGS(RegionBench, (p, SMALL, diffrect_proc, "differencerect")); }
static SkBenchmark* gF4(void* p) { return SkNEW_ARGS(RegionBench, (p, SMALL, diffrectbig_proc, "differencerectbig")); }
-static SkBenchmark* gF5(void* p) { return SkNEW_ARGS(RegionBench, (p, SMALL, containsrect_proc, "containsrect", 100)); }
-static SkBenchmark* gF6(void* p) { return SkNEW_ARGS(RegionBench, (p, SMALL, sectsrgn_proc, "intersectsrgn", 10)); }
-static SkBenchmark* gF7(void* p) { return SkNEW_ARGS(RegionBench, (p, SMALL, sectsrect_proc, "intersectsrect", 200)); }
+static SkBenchmark* gF5(void* p) { return SkNEW_ARGS(RegionBench, (p, SMALL, containsrect_proc, "containsrect")); }
+static SkBenchmark* gF6(void* p) { return SkNEW_ARGS(RegionBench, (p, SMALL, sectsrgn_proc, "intersectsrgn")); }
+static SkBenchmark* gF7(void* p) { return SkNEW_ARGS(RegionBench, (p, SMALL, sectsrect_proc, "intersectsrect")); }
static SkBenchmark* gF8(void* p) { return SkNEW_ARGS(RegionBench, (p, SMALL, containsxy_proc, "containsxy")); }
static BenchRegistry gR0(gF0);