Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(124)

Side by Side Diff: bench/InterpBench.cpp

Issue 73643005: Implement a benchmark for GrResourceCache (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: address comments Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « bench/ImageDecodeBench.cpp ('k') | bench/MathBench.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #include "SkBenchmark.h" 1 #include "SkBenchmark.h"
2 #include "SkColorPriv.h" 2 #include "SkColorPriv.h"
3 #include "SkMatrix.h" 3 #include "SkMatrix.h"
4 #include "SkRandom.h" 4 #include "SkRandom.h"
5 #include "SkString.h" 5 #include "SkString.h"
6 #include "SkPaint.h" 6 #include "SkPaint.h"
7 7
8 #define TILE(x, width) (((x) & 0xFFFF) * width >> 16) 8 #define TILE(x, width) (((x) & 0xFFFF) * width >> 16)
9 9
10 class InterpBench : public SkBenchmark { 10 class InterpBench : public SkBenchmark {
11 enum { 11 enum {
12 kBuffer = 128, 12 kBuffer = 128,
13 kLoop = 20000 13 kLoop = 20000
14 }; 14 };
15 SkString fName; 15 SkString fName;
16 int16_t fDst[kBuffer]; 16 int16_t fDst[kBuffer];
17 float fFx, fDx; 17 float fFx, fDx;
18 public: 18 public:
19 InterpBench(const char name[]) { 19 InterpBench(const char name[]) {
20 fName.printf("interp_%s", name); 20 fName.printf("interp_%s", name);
21 fFx = 3.3f; 21 fFx = 3.3f;
22 fDx = 0.1257f; 22 fDx = 0.1257f;
23 fIsRendering = false; 23 }
24
25 virtual bool isSuitableFor(Backend backend) SK_OVERRIDE {
26 return backend == kNonRendering_Backend;
24 } 27 }
25 28
26 virtual void performTest(int16_t dst[], float x, float dx, int count) = 0; 29 virtual void performTest(int16_t dst[], float x, float dx, int count) = 0;
27 30
28 protected: 31 protected:
29 virtual int mulLoopCount() const { return 1; } 32 virtual int mulLoopCount() const { return 1; }
30 33
31 virtual const char* onGetName() { 34 virtual const char* onGetName() {
32 return fName.c_str(); 35 return fName.c_str();
33 } 36 }
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 typedef InterpBench INHERITED; 154 typedef InterpBench INHERITED;
152 }; 155 };
153 156
154 /////////////////////////////////////////////////////////////////////////////// 157 ///////////////////////////////////////////////////////////////////////////////
155 158
156 DEF_BENCH( return new Fixed16D16Interp(); ) 159 DEF_BENCH( return new Fixed16D16Interp(); )
157 DEF_BENCH( return new Fixed32D32Interp(); ) 160 DEF_BENCH( return new Fixed32D32Interp(); )
158 DEF_BENCH( return new Fixed16D48Interp(); ) 161 DEF_BENCH( return new Fixed16D48Interp(); )
159 DEF_BENCH( return new FloatInterp(); ) 162 DEF_BENCH( return new FloatInterp(); )
160 DEF_BENCH( return new DoubleInterp(); ) 163 DEF_BENCH( return new DoubleInterp(); )
OLDNEW
« no previous file with comments | « bench/ImageDecodeBench.cpp ('k') | bench/MathBench.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698