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 "Benchmark.h" | 7 #include "Benchmark.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 27 matching lines...) Expand all Loading... |
38 return backend == kNonRendering_Backend; | 38 return backend == kNonRendering_Backend; |
39 } | 39 } |
40 | 40 |
41 protected: | 41 protected: |
42 const char* onGetName() override { | 42 const char* onGetName() override { |
43 switch (fType) { | 43 switch (fType) { |
44 case kMD5_ChecksumType: return "compute_md5"; | 44 case kMD5_ChecksumType: return "compute_md5"; |
45 case kSHA1_ChecksumType: return "compute_sha1"; | 45 case kSHA1_ChecksumType: return "compute_sha1"; |
46 case kMurmur3_ChecksumType: return "compute_murmur3"; | 46 case kMurmur3_ChecksumType: return "compute_murmur3"; |
47 | 47 |
48 default: SK_ABORT("Invalid Type"); return ""; | 48 default: SK_CRASH(); return ""; |
49 } | 49 } |
50 } | 50 } |
51 | 51 |
52 void onDraw(int loops, SkCanvas*) override { | 52 void onDraw(int loops, SkCanvas*) override { |
53 switch (fType) { | 53 switch (fType) { |
54 case kMD5_ChecksumType: { | 54 case kMD5_ChecksumType: { |
55 for (int i = 0; i < loops; i++) { | 55 for (int i = 0; i < loops; i++) { |
56 SkMD5 md5; | 56 SkMD5 md5; |
57 md5.update(reinterpret_cast<uint8_t*>(fData), sizeof(fData))
; | 57 md5.update(reinterpret_cast<uint8_t*>(fData), sizeof(fData))
; |
58 SkMD5::Digest digest; | 58 SkMD5::Digest digest; |
(...skipping 20 matching lines...) Expand all Loading... |
79 | 79 |
80 private: | 80 private: |
81 typedef Benchmark INHERITED; | 81 typedef Benchmark INHERITED; |
82 }; | 82 }; |
83 | 83 |
84 /////////////////////////////////////////////////////////////////////////////// | 84 /////////////////////////////////////////////////////////////////////////////// |
85 | 85 |
86 DEF_BENCH( return new ComputeChecksumBench(kMD5_ChecksumType); ) | 86 DEF_BENCH( return new ComputeChecksumBench(kMD5_ChecksumType); ) |
87 DEF_BENCH( return new ComputeChecksumBench(kSHA1_ChecksumType); ) | 87 DEF_BENCH( return new ComputeChecksumBench(kSHA1_ChecksumType); ) |
88 DEF_BENCH( return new ComputeChecksumBench(kMurmur3_ChecksumType); ) | 88 DEF_BENCH( return new ComputeChecksumBench(kMurmur3_ChecksumType); ) |
OLD | NEW |