From 88db9ef0cd8646171f35a3325706291070b5dc55 Mon Sep 17 00:00:00 2001 From: "reed@google.com" Date: Tue, 3 Jul 2012 19:44:20 +0000 Subject: 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 --- bench/ChecksumBench.cpp | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) (limited to 'bench/ChecksumBench.cpp') 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(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); -- cgit v1.2.3