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
diff --git a/bench/AAClipBench.cpp b/bench/AAClipBench.cpp
index 276a8ff..3c04bd4 100644
--- a/bench/AAClipBench.cpp
+++ b/bench/AAClipBench.cpp
@@ -23,10 +23,6 @@
bool fDoPath;
bool fDoAA;
- enum {
- N = SkBENCHLOOP(200),
- };
-
public:
AAClipBench(void* param, bool doPath, bool doAA)
: INHERITED(param)
@@ -53,7 +49,7 @@
SkPaint paint;
this->setupPaint(&paint);
- for (int i = 0; i < N; ++i) {
+ for (int i = 0; i < this->getLoops(); ++i) {
// jostle the clip regions each time to prevent caching
fClipRect.offset((i % 2) == 0 ? SkIntToScalar(10) : SkIntToScalar(-10), 0);
fClipPath.reset();
@@ -96,7 +92,6 @@
SkRect fDrawRect;
SkRandom fRandom;
- static const int kNumDraws = SkBENCHLOOP(2);
static const int kNestingDepth = 3;
static const int kImageSize = 400;
@@ -169,7 +164,7 @@
virtual void onDraw(SkCanvas* canvas) {
- for (int i = 0; i < kNumDraws; ++i) {
+ for (int i = 0; i < this->getLoops(); ++i) {
SkPoint offset = SkPoint::Make(0, 0);
this->recurse(canvas, 0, offset);
}
@@ -188,10 +183,6 @@
bool fDoPath;
bool fDoAA;
- enum {
- N = SkBENCHLOOP(200),
- };
-
public:
AAClipBuilderBench(void* param, bool doPath, bool doAA) : INHERITED(param) {
fDoPath = doPath;
@@ -212,7 +203,7 @@
SkPaint paint;
this->setupPaint(&paint);
- for (int i = 0; i < N; ++i) {
+ for (int i = 0; i < this->getLoops(); ++i) {
SkAAClip clip;
if (fDoPath) {
clip.setPath(fPath, &fRegion, fDoAA);
@@ -244,16 +235,13 @@
protected:
virtual const char* onGetName() { return "aaclip_setregion"; }
virtual void onDraw(SkCanvas*) {
- for (int i = 0; i < N; ++i) {
+ for (int i = 0; i < this->getLoops(); ++i) {
SkAAClip clip;
clip.setRegion(fRegion);
}
}
private:
- enum {
- N = SkBENCHLOOP(400),
- };
SkRegion fRegion;
typedef SkBenchmark INHERITED;
};