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

Side by Side Diff: bench/ChecksumBench.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 | « no previous file | bench/DecodeBench.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 /* 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 15 matching lines...) Expand all
26 }; 26 };
27 uint32_t fData[U32COUNT]; 27 uint32_t fData[U32COUNT];
28 ChecksumType fType; 28 ChecksumType fType;
29 29
30 public: 30 public:
31 ComputeChecksumBench(ChecksumType type) : fType(type) { 31 ComputeChecksumBench(ChecksumType type) : fType(type) {
32 SkRandom rand; 32 SkRandom rand;
33 for (int i = 0; i < U32COUNT; ++i) { 33 for (int i = 0; i < U32COUNT; ++i) {
34 fData[i] = rand.nextU(); 34 fData[i] = rand.nextU();
35 } 35 }
36 fIsRendering = false; 36 }
37
38 virtual bool isSuitableFor(Backend backend) SK_OVERRIDE {
39 return backend == kNonRendering_Backend;
37 } 40 }
38 41
39 protected: 42 protected:
40 virtual const char* onGetName() { 43 virtual const char* onGetName() {
41 switch (fType) { 44 switch (fType) {
42 case kChecksum_ChecksumType: return "compute_checksum"; 45 case kChecksum_ChecksumType: return "compute_checksum";
43 case kMD5_ChecksumType: return "compute_md5"; 46 case kMD5_ChecksumType: return "compute_md5";
44 case kSHA1_ChecksumType: return "compute_sha1"; 47 case kSHA1_ChecksumType: return "compute_sha1";
45 case kMurmur3_ChecksumType: return "compute_murmur3"; 48 case kMurmur3_ChecksumType: return "compute_murmur3";
46 49
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 private: 88 private:
86 typedef SkBenchmark INHERITED; 89 typedef SkBenchmark INHERITED;
87 }; 90 };
88 91
89 /////////////////////////////////////////////////////////////////////////////// 92 ///////////////////////////////////////////////////////////////////////////////
90 93
91 DEF_BENCH( return new ComputeChecksumBench(kChecksum_ChecksumType); ) 94 DEF_BENCH( return new ComputeChecksumBench(kChecksum_ChecksumType); )
92 DEF_BENCH( return new ComputeChecksumBench(kMD5_ChecksumType); ) 95 DEF_BENCH( return new ComputeChecksumBench(kMD5_ChecksumType); )
93 DEF_BENCH( return new ComputeChecksumBench(kSHA1_ChecksumType); ) 96 DEF_BENCH( return new ComputeChecksumBench(kSHA1_ChecksumType); )
94 DEF_BENCH( return new ComputeChecksumBench(kMurmur3_ChecksumType); ) 97 DEF_BENCH( return new ComputeChecksumBench(kMurmur3_ChecksumType); )
OLDNEW
« no previous file with comments | « no previous file | bench/DecodeBench.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698