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/GradientBench.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'bench/GradientBench.cpp') diff --git a/bench/GradientBench.cpp b/bench/GradientBench.cpp index 773522e164..8dec68bfc3 100644 --- a/bench/GradientBench.cpp +++ b/bench/GradientBench.cpp @@ -159,11 +159,10 @@ static const char* geomtypename(GeomType gt) { class GradientBench : public SkBenchmark { SkString fName; SkShader* fShader; - int fCount; + int fRepeat; enum { W = 400, H = 400, - N = 1 }; public: GradientBench(void* param, GradType gradType, @@ -187,7 +186,7 @@ public: { SkIntToScalar(W), SkIntToScalar(H) } }; - fCount = SkBENCHLOOP(N * gGrads[gradType].fRepeat); + fRepeat = gGrads[gradType].fRepeat; fShader = gGrads[gradType].fMaker(pts, data, tm, NULL, scale); fGeomType = geomType; } @@ -208,7 +207,7 @@ protected: paint.setShader(fShader); SkRect r = { 0, 0, SkIntToScalar(W), SkIntToScalar(H) }; - for (int i = 0; i < fCount; i++) { + for (int i = 0; i < this->getLoops() * fRepeat; i++) { switch (fGeomType) { case kRect_GeomType: canvas->drawRect(r, paint); @@ -251,7 +250,7 @@ protected: { SkIntToScalar(100), SkIntToScalar(100) }, }; - for (int i = 0; i < SkBENCHLOOP(1000); i++) { + for (int i = 0; i < this->getLoops(); i++) { const int gray = i % 256; const int alpha = fHasAlpha ? gray : 0xFF; SkColor colors[] = { -- cgit v1.2.3