| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 #include "SkBenchmark.h" | 7 #include "SkBenchmark.h" |
| 8 #include "SkCanvas.h" | 8 #include "SkCanvas.h" |
| 9 #include "SkChecksum.h" | 9 #include "SkChecksum.h" |
| 10 #include "SkMD5.h" | 10 #include "SkMD5.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 enum { | 23 enum { |
| 24 U32COUNT = 256, | 24 U32COUNT = 256, |
| 25 SIZE = U32COUNT * 4, | 25 SIZE = U32COUNT * 4, |
| 26 N = SkBENCHLOOP(100000), | 26 N = SkBENCHLOOP(100000), |
| 27 }; | 27 }; |
| 28 uint32_t fData[U32COUNT]; | 28 uint32_t fData[U32COUNT]; |
| 29 ChecksumType fType; | 29 ChecksumType fType; |
| 30 | 30 |
| 31 public: | 31 public: |
| 32 ComputeChecksumBench(void* param, ChecksumType type) : INHERITED(param), fTy
pe(type) { | 32 ComputeChecksumBench(void* param, ChecksumType type) : INHERITED(param), fTy
pe(type) { |
| 33 SkMWCRandom rand; | 33 SkRandom rand; |
| 34 for (int i = 0; i < U32COUNT; ++i) { | 34 for (int i = 0; i < U32COUNT; ++i) { |
| 35 fData[i] = rand.nextU(); | 35 fData[i] = rand.nextU(); |
| 36 } | 36 } |
| 37 fIsRendering = false; | 37 fIsRendering = false; |
| 38 } | 38 } |
| 39 | 39 |
| 40 protected: | 40 protected: |
| 41 virtual const char* onGetName() { | 41 virtual const char* onGetName() { |
| 42 switch (fType) { | 42 switch (fType) { |
| 43 case kChecksum_ChecksumType: return "compute_checksum"; | 43 case kChecksum_ChecksumType: return "compute_checksum"; |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 static SkBenchmark* Fact0(void* p) { return new ComputeChecksumBench(p, kChecksu
m_ChecksumType); } | 92 static SkBenchmark* Fact0(void* p) { return new ComputeChecksumBench(p, kChecksu
m_ChecksumType); } |
| 93 static SkBenchmark* Fact1(void* p) { return new ComputeChecksumBench(p, kMD5_Che
cksumType); } | 93 static SkBenchmark* Fact1(void* p) { return new ComputeChecksumBench(p, kMD5_Che
cksumType); } |
| 94 static SkBenchmark* Fact2(void* p) { return new ComputeChecksumBench(p, kSHA1_Ch
ecksumType); } | 94 static SkBenchmark* Fact2(void* p) { return new ComputeChecksumBench(p, kSHA1_Ch
ecksumType); } |
| 95 static SkBenchmark* Fact3(void* p) { return new ComputeChecksumBench(p, kMurmur3
_ChecksumType); } | 95 static SkBenchmark* Fact3(void* p) { return new ComputeChecksumBench(p, kMurmur3
_ChecksumType); } |
| 96 | 96 |
| 97 | 97 |
| 98 static BenchRegistry gReg0(Fact0); | 98 static BenchRegistry gReg0(Fact0); |
| 99 static BenchRegistry gReg1(Fact1); | 99 static BenchRegistry gReg1(Fact1); |
| 100 static BenchRegistry gReg2(Fact2); | 100 static BenchRegistry gReg2(Fact2); |
| 101 static BenchRegistry gReg3(Fact3); | 101 static BenchRegistry gReg3(Fact3); |
| OLD | NEW |