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/RefCntBench.cpp b/bench/RefCntBench.cpp
index 26c98b9..2cc7688 100644
--- a/bench/RefCntBench.cpp
+++ b/bench/RefCntBench.cpp
@@ -11,8 +11,7 @@
#include <memory>
enum {
- N = SkBENCHLOOP(100000),
- M = SkBENCHLOOP(2)
+ M = 2
};
class RefCntBench_Stack : public SkBenchmark {
@@ -26,7 +25,7 @@
}
virtual void onDraw(SkCanvas*) {
- for (int i = 0; i < N; ++i) {
+ for (int i = 0; i < this->getLoops(); ++i) {
SkRefCnt ref;
for (int j = 0; j < M; ++j) {
ref.ref();
@@ -64,7 +63,7 @@
virtual void onDraw(SkCanvas*) {
char memory[sizeof(PlacedRefCnt)];
- for (int i = 0; i < N; ++i) {
+ for (int i = 0; i < this->getLoops(); ++i) {
PlacedRefCnt* ref = new (memory) PlacedRefCnt();
for (int j = 0; j < M; ++j) {
ref->ref();
@@ -89,7 +88,7 @@
}
virtual void onDraw(SkCanvas*) {
- for (int i = 0; i < N; ++i) {
+ for (int i = 0; i < this->getLoops(); ++i) {
SkRefCnt* ref = new SkRefCnt();
for (int j = 0; j < M; ++j) {
ref->ref();
@@ -116,7 +115,7 @@
}
virtual void onDraw(SkCanvas*) {
- for (int i = 0; i < N; ++i) {
+ for (int i = 0; i < this->getLoops(); ++i) {
SkWeakRefCnt ref;
for (int j = 0; j < M; ++j) {
ref.ref();
@@ -147,7 +146,7 @@
virtual void onDraw(SkCanvas*) {
char memory[sizeof(PlacedWeakRefCnt)];
- for (int i = 0; i < N; ++i) {
+ for (int i = 0; i < this->getLoops(); ++i) {
PlacedWeakRefCnt* ref = new (memory) PlacedWeakRefCnt();
for (int j = 0; j < M; ++j) {
ref->ref();
@@ -172,7 +171,7 @@
}
virtual void onDraw(SkCanvas*) {
- for (int i = 0; i < N; ++i) {
+ for (int i = 0; i < this->getLoops(); ++i) {
SkWeakRefCnt* ref = new SkWeakRefCnt();
for (int j = 0; j < M; ++j) {
ref->ref();