aboutsummaryrefslogtreecommitdiffhomepage
path: root/bench/MatrixBench.cpp
diff options
context:
space:
mode:
authorGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2011-06-06 13:31:30 +0000
committerGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2011-06-06 13:31:30 +0000
commitcbefd7d842945a8a7cc21770b19f41e0f3f3b205 (patch)
tree852fdf6fad65ba4a7a4ec8ae1e83c3a59bed8fb2 /bench/MatrixBench.cpp
parente0dcde73991a13be48f2aed9829d5e744d7fe508 (diff)
add internal multiplier for loopcount, to reduce variance for simple/fast tests
git-svn-id: http://skia.googlecode.com/svn/trunk@1510 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'bench/MatrixBench.cpp')
-rw-r--r--bench/MatrixBench.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/bench/MatrixBench.cpp b/bench/MatrixBench.cpp
index eb7d39f5db..d963bc7126 100644
--- a/bench/MatrixBench.cpp
+++ b/bench/MatrixBench.cpp
@@ -14,12 +14,15 @@ public:
virtual void performTest() = 0;
protected:
+ virtual int mulLoopCount() const { return 1; }
+
virtual const char* onGetName() {
return fName.c_str();
}
virtual void onDraw(SkCanvas* canvas) {
- for (int i = 0; i < N; i++) {
+ int n = N * this->mulLoopCount();
+ for (int i = 0; i < n; i++) {
this->performTest();
}
}
@@ -103,6 +106,8 @@ public:
init9(myr);
}
protected:
+ virtual int mulLoopCount() const { return 4; }
+
static inline void muladdmul(float a, float b, float c, float d,
float* result) {
*result = a * b + c * d;
@@ -144,6 +149,8 @@ public:
init9(myr);
}
protected:
+ virtual int mulLoopCount() const { return 4; }
+
static inline void muladdmul(float a, float b, float c, float d,
float* result) {
*result = SkDoubleToFloat((double)a * b + (double)c * d);
@@ -180,6 +187,8 @@ public:
init9(myr);
}
protected:
+ virtual int mulLoopCount() const { return 4; }
+
static inline void muladdmul(double a, double b, double c, double d,
double* result) {
*result = a * b + c * d;