From c289743864e2ab926a95e617a5cd1d29b26d1825 Mon Sep 17 00:00:00 2001 From: "mtklein@google.com" Date: Tue, 10 Sep 2013 19:23:38 +0000 Subject: 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 --- bench/RegionBench.cpp | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) (limited to 'bench/RegionBench.cpp') 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); -- cgit v1.2.3