In debug builds, only run each benchmark 1 time (test for assertion-breakage,
not performance). codereview.appspot.com/5314064/ git-svn-id: http://skia.googlecode.com/svn/trunk@2552 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
parent
8382394bf2
commit
ca529d303e
@ -103,7 +103,7 @@ class BitmapBench : public SkBenchmark {
|
|||||||
bool fForceUpdate; //bitmap marked as dirty before each draw. forces bitmap to be updated on device cache
|
bool fForceUpdate; //bitmap marked as dirty before each draw. forces bitmap to be updated on device cache
|
||||||
int fTileX, fTileY; // -1 means don't use shader
|
int fTileX, fTileY; // -1 means don't use shader
|
||||||
SkString fName;
|
SkString fName;
|
||||||
enum { N = 300 };
|
enum { N = SkBENCHLOOP(300) };
|
||||||
public:
|
public:
|
||||||
BitmapBench(void* param, bool isOpaque, SkBitmap::Config c,
|
BitmapBench(void* param, bool isOpaque, SkBitmap::Config c,
|
||||||
bool forceUpdate = false, bool bitmapVolatile = false,
|
bool forceUpdate = false, bool bitmapVolatile = false,
|
||||||
|
@ -48,7 +48,7 @@ protected:
|
|||||||
paint.setAntiAlias(true);
|
paint.setAntiAlias(true);
|
||||||
|
|
||||||
SkRandom rand;
|
SkRandom rand;
|
||||||
for (int i = 0; i < 10; i++) {
|
for (int i = 0; i < SkBENCHLOOP(10); i++) {
|
||||||
SkRect r = SkRect::MakeWH(rand.nextUScalar1() * 400,
|
SkRect r = SkRect::MakeWH(rand.nextUScalar1() * 400,
|
||||||
rand.nextUScalar1() * 400);
|
rand.nextUScalar1() * 400);
|
||||||
r.offset(fRadius, fRadius);
|
r.offset(fRadius, fRadius);
|
||||||
|
@ -468,7 +468,7 @@ protected:
|
|||||||
for (int i = 0; i < N; i++) {
|
for (int i = 0; i < N; i++) {
|
||||||
SkRect current;
|
SkRect current;
|
||||||
setRectangle(current, i);
|
setRectangle(current, i);
|
||||||
for (int j = 0; j < gmailScrollingRectSpec[i*3]; j++) {
|
for (int j = 0; j < SkBENCHLOOP(gmailScrollingRectSpec[i*3]); j++) {
|
||||||
canvas->drawRect(current, paint);
|
canvas->drawRect(current, paint);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,7 @@ class DecodeBench : public SkBenchmark {
|
|||||||
const char* fFilename;
|
const char* fFilename;
|
||||||
SkBitmap::Config fPrefConfig;
|
SkBitmap::Config fPrefConfig;
|
||||||
SkString fName;
|
SkString fName;
|
||||||
enum { N = 10 };
|
enum { N = SkBENCHLOOP(10) };
|
||||||
public:
|
public:
|
||||||
DecodeBench(void* param, SkBitmap::Config c) : SkBenchmark(param) {
|
DecodeBench(void* param, SkBitmap::Config c) : SkBenchmark(param) {
|
||||||
fFilename = this->findDefine("decode-filename");
|
fFilename = this->findDefine("decode-filename");
|
||||||
|
@ -165,7 +165,7 @@ public:
|
|||||||
{ SkIntToScalar(W), SkIntToScalar(H) }
|
{ SkIntToScalar(W), SkIntToScalar(H) }
|
||||||
};
|
};
|
||||||
|
|
||||||
fCount = N * gGrads[gradType].fRepeat;
|
fCount = SkBENCHLOOP(N * gGrads[gradType].fRepeat);
|
||||||
fShader = gGrads[gradType].fMaker(pts, gGradData[0], tm, NULL, scale);
|
fShader = gGrads[gradType].fMaker(pts, gGradData[0], tm, NULL, scale);
|
||||||
fGeomType = geomType;
|
fGeomType = geomType;
|
||||||
}
|
}
|
||||||
@ -223,7 +223,7 @@ protected:
|
|||||||
{ SkIntToScalar(100), SkIntToScalar(100) },
|
{ SkIntToScalar(100), SkIntToScalar(100) },
|
||||||
};
|
};
|
||||||
|
|
||||||
for (int i = 0; i < 1000; i++) {
|
for (int i = 0; i < SkBENCHLOOP(1000); i++) {
|
||||||
const int a = i % 256;
|
const int a = i % 256;
|
||||||
SkColor colors[] = {
|
SkColor colors[] = {
|
||||||
SK_ColorBLACK,
|
SK_ColorBLACK,
|
||||||
|
@ -31,7 +31,7 @@ protected:
|
|||||||
}
|
}
|
||||||
|
|
||||||
virtual void onDraw(SkCanvas* canvas) {
|
virtual void onDraw(SkCanvas* canvas) {
|
||||||
int n = kLoop * this->mulLoopCount();
|
int n = SkBENCHLOOP(kLoop * this->mulLoopCount());
|
||||||
for (int i = 0; i < n; i++) {
|
for (int i = 0; i < n; i++) {
|
||||||
this->performTest(fDst, fSrc, kBuffer);
|
this->performTest(fDst, fSrc, kBuffer);
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@ protected:
|
|||||||
}
|
}
|
||||||
|
|
||||||
virtual void onDraw(SkCanvas* canvas) {
|
virtual void onDraw(SkCanvas* canvas) {
|
||||||
int n = N * this->mulLoopCount();
|
int n = SkBENCHLOOP(N * this->mulLoopCount());
|
||||||
for (int i = 0; i < n; i++) {
|
for (int i = 0; i < n; i++) {
|
||||||
this->performTest();
|
this->performTest();
|
||||||
}
|
}
|
||||||
@ -271,7 +271,7 @@ class ScaleTransMixedMatrixBench : public MatrixBench {
|
|||||||
fRandom.nextS(), fRandom.nextS(), fRandom.nextS(),
|
fRandom.nextS(), fRandom.nextS(), fRandom.nextS(),
|
||||||
fRandom.nextS(), fRandom.nextS(), fRandom.nextS());
|
fRandom.nextS(), fRandom.nextS(), fRandom.nextS());
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < fCount; i++) {
|
for (i = 0; i < SkBENCHLOOP(fCount); i++) {
|
||||||
fSrc[i].fX = fRandom.nextSScalar1();
|
fSrc[i].fX = fRandom.nextSScalar1();
|
||||||
fSrc[i].fY = fRandom.nextSScalar1();
|
fSrc[i].fY = fRandom.nextSScalar1();
|
||||||
fDst[i].fX = fRandom.nextSScalar1();
|
fDst[i].fX = fRandom.nextSScalar1();
|
||||||
@ -282,7 +282,7 @@ class ScaleTransMixedMatrixBench : public MatrixBench {
|
|||||||
virtual void performTest() {
|
virtual void performTest() {
|
||||||
SkPoint* dst = fDst;
|
SkPoint* dst = fDst;
|
||||||
const SkPoint* src = fSrc;
|
const SkPoint* src = fSrc;
|
||||||
int count = fCount;
|
int count = SkBENCHLOOP(fCount);
|
||||||
float mx = fMatrix[SkMatrix::kMScaleX];
|
float mx = fMatrix[SkMatrix::kMScaleX];
|
||||||
float my = fMatrix[SkMatrix::kMScaleY];
|
float my = fMatrix[SkMatrix::kMScaleY];
|
||||||
float tx = fMatrix[SkMatrix::kMTransX];
|
float tx = fMatrix[SkMatrix::kMTransX];
|
||||||
@ -308,7 +308,7 @@ class ScaleTransDoubleMatrixBench : public MatrixBench {
|
|||||||
ScaleTransDoubleMatrixBench(void* p) : INHERITED(p, "scaletrans_double"), fCount (16) {
|
ScaleTransDoubleMatrixBench(void* p) : INHERITED(p, "scaletrans_double"), fCount (16) {
|
||||||
init9(fMatrix);
|
init9(fMatrix);
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < fCount; i++) {
|
for (i = 0; i < SkBENCHLOOP(fCount); i++) {
|
||||||
fSrc[i].fX = fRandom.nextSScalar1();
|
fSrc[i].fX = fRandom.nextSScalar1();
|
||||||
fSrc[i].fY = fRandom.nextSScalar1();
|
fSrc[i].fY = fRandom.nextSScalar1();
|
||||||
fDst[i].fX = fRandom.nextSScalar1();
|
fDst[i].fX = fRandom.nextSScalar1();
|
||||||
@ -319,7 +319,7 @@ class ScaleTransDoubleMatrixBench : public MatrixBench {
|
|||||||
virtual void performTest() {
|
virtual void performTest() {
|
||||||
SkPoint* dst = fDst;
|
SkPoint* dst = fDst;
|
||||||
const SkPoint* src = fSrc;
|
const SkPoint* src = fSrc;
|
||||||
int count = fCount;
|
int count = SkBENCHLOOP(fCount);
|
||||||
// As doubles, on Z600 Linux systems this is 2.5x as expensive as mixed mode
|
// As doubles, on Z600 Linux systems this is 2.5x as expensive as mixed mode
|
||||||
float mx = (float) fMatrix[SkMatrix::kMScaleX];
|
float mx = (float) fMatrix[SkMatrix::kMScaleX];
|
||||||
float my = (float) fMatrix[SkMatrix::kMScaleY];
|
float my = (float) fMatrix[SkMatrix::kMScaleY];
|
||||||
|
@ -28,7 +28,7 @@ class PathBench : public SkBenchmark {
|
|||||||
SkPaint fPaint;
|
SkPaint fPaint;
|
||||||
SkString fName;
|
SkString fName;
|
||||||
Flags fFlags;
|
Flags fFlags;
|
||||||
enum { N = 1000 };
|
enum { N = SkBENCHLOOP(1000) };
|
||||||
public:
|
public:
|
||||||
PathBench(void* param, Flags flags) : INHERITED(param), fFlags(flags) {
|
PathBench(void* param, Flags flags) : INHERITED(param), fFlags(flags) {
|
||||||
fPaint.setStyle(flags & kStroke_Flag ? SkPaint::kStroke_Style :
|
fPaint.setStyle(flags & kStroke_Flag ? SkPaint::kStroke_Style :
|
||||||
|
@ -18,7 +18,7 @@ public:
|
|||||||
enum {
|
enum {
|
||||||
W = 640,
|
W = 640,
|
||||||
H = 480,
|
H = 480,
|
||||||
N = 300
|
N = SkBENCHLOOP(300)
|
||||||
};
|
};
|
||||||
SkRect fRects[N];
|
SkRect fRects[N];
|
||||||
SkColor fColors[N];
|
SkColor fColors[N];
|
||||||
|
@ -86,7 +86,7 @@ static void convertToIndex666(const SkBitmap& src, SkBitmap* dst) {
|
|||||||
class RepeatTileBench : public SkBenchmark {
|
class RepeatTileBench : public SkBenchmark {
|
||||||
SkPaint fPaint;
|
SkPaint fPaint;
|
||||||
SkString fName;
|
SkString fName;
|
||||||
enum { N = 20 };
|
enum { N = SkBENCHLOOP(20) };
|
||||||
public:
|
public:
|
||||||
RepeatTileBench(void* param, SkBitmap::Config c) : INHERITED(param) {
|
RepeatTileBench(void* param, SkBitmap::Config c) : INHERITED(param) {
|
||||||
const int w = 50;
|
const int w = 50;
|
||||||
|
@ -28,7 +28,7 @@ protected:
|
|||||||
}
|
}
|
||||||
|
|
||||||
virtual void onDraw(SkCanvas* canvas) {
|
virtual void onDraw(SkCanvas* canvas) {
|
||||||
int n = N * this->mulLoopCount();
|
int n = SkBENCHLOOP(N * this->mulLoopCount());
|
||||||
for (int i = 0; i < n; i++) {
|
for (int i = 0; i < n; i++) {
|
||||||
this->performTest();
|
this->performTest();
|
||||||
}
|
}
|
||||||
|
@ -13,6 +13,12 @@
|
|||||||
#include "SkTDict.h"
|
#include "SkTDict.h"
|
||||||
#include "SkTRegistry.h"
|
#include "SkTRegistry.h"
|
||||||
|
|
||||||
|
#ifdef SK_DEBUG
|
||||||
|
#define SkBENCHLOOP(n) 1
|
||||||
|
#else
|
||||||
|
#define SkBENCHLOOP(n) n
|
||||||
|
#endif
|
||||||
|
|
||||||
class SkCanvas;
|
class SkCanvas;
|
||||||
class SkPaint;
|
class SkPaint;
|
||||||
|
|
||||||
|
@ -44,7 +44,7 @@ class TextBench : public SkBenchmark {
|
|||||||
SkString fText;
|
SkString fText;
|
||||||
SkString fName;
|
SkString fName;
|
||||||
FontQuality fFQ;
|
FontQuality fFQ;
|
||||||
enum { N = 800 };
|
enum { N = SkBENCHLOOP(800) };
|
||||||
public:
|
public:
|
||||||
TextBench(void* param, const char text[], int ps,
|
TextBench(void* param, const char text[], int ps,
|
||||||
SkColor color, FontQuality fq) : INHERITED(param) {
|
SkColor color, FontQuality fq) : INHERITED(param) {
|
||||||
|
Loading…
Reference in New Issue
Block a user