diff options
author | reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2012-07-03 19:44:20 +0000 |
---|---|---|
committer | reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2012-07-03 19:44:20 +0000 |
commit | 88db9ef0cd8646171f35a3325706291070b5dc55 (patch) | |
tree | bac1288c36ee57bf9ac9ec83eaa9339654e1b7cb /bench/ChecksumBench.cpp | |
parent | 54823c227d383308fb1732e83b566df6272d4bfb (diff) |
add SkChecksum as a static class, for the replacement API
after this lands, plan to deprecate/remove the older APIs
Review URL: https://codereview.appspot.com/6356059
git-svn-id: http://skia.googlecode.com/svn/trunk@4457 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'bench/ChecksumBench.cpp')
-rw-r--r-- | bench/ChecksumBench.cpp | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/bench/ChecksumBench.cpp b/bench/ChecksumBench.cpp index 9057d1272b..903e584c55 100644 --- a/bench/ChecksumBench.cpp +++ b/bench/ChecksumBench.cpp @@ -61,15 +61,33 @@ private: class ComputeChecksum64Bench : public ComputeChecksumBench { public: ComputeChecksum64Bench(void* param) - : INHERITED(param, "64") { } - + : INHERITED(param, "64") { } + protected: virtual void computeChecksum(const uint64_t* data, size_t len) { for (int i = 0; i < N; i++) { volatile uint64_t result = SkComputeChecksum64(data, len); } } + +private: + typedef ComputeChecksumBench INHERITED; +}; +/* + * Use SkComputeChecksum64 to compute a checksum on a datablock + */ +class ComputeChecksumXXBench : public ComputeChecksumBench { +public: + ComputeChecksumXXBench(void* param) : INHERITED(param, "XX") { } + +protected: + virtual void computeChecksum(const uint64_t* data, size_t len) { + for (int i = 0; i < N; i++) { + volatile uint32_t result = SkChecksum::Compute(reinterpret_cast<const uint32_t*>(data), len); + } + } + private: typedef ComputeChecksumBench INHERITED; }; @@ -78,6 +96,8 @@ private: static SkBenchmark* Fact0(void* p) { return new ComputeChecksum32Bench(p); } static SkBenchmark* Fact1(void* p) { return new ComputeChecksum64Bench(p); } +static SkBenchmark* Fact2(void* p) { return new ComputeChecksumXXBench(p); } static BenchRegistry gReg0(Fact0); static BenchRegistry gReg1(Fact1); +static BenchRegistry gReg2(Fact2); |