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

Side by Side Diff: bench/MemoryBench.cpp

Issue 1379923005: Remove const from `const int loops`. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: n too Created 5 years, 2 months 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
« no previous file with comments | « bench/MatrixConvolutionBench.cpp ('k') | bench/MemsetBench.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 7
8 #include "Benchmark.h" 8 #include "Benchmark.h"
9 #include "SkCanvas.h" 9 #include "SkCanvas.h"
10 #include "SkChunkAlloc.h" 10 #include "SkChunkAlloc.h"
(...skipping 12 matching lines...) Expand all
23 23
24 bool isSuitableFor(Backend backend) override { 24 bool isSuitableFor(Backend backend) override {
25 return backend == kNonRendering_Backend; 25 return backend == kNonRendering_Backend;
26 } 26 }
27 27
28 protected: 28 protected:
29 const char* onGetName() override { 29 const char* onGetName() override {
30 return fName.c_str(); 30 return fName.c_str();
31 } 31 }
32 32
33 void onDraw(const int loops, SkCanvas*) override { 33 void onDraw(int loops, SkCanvas*) override {
34 size_t inc = fMinSize >> 4; 34 size_t inc = fMinSize >> 4;
35 SkASSERT(inc > 0); 35 SkASSERT(inc > 0);
36 size_t total = fMinSize * 64; 36 size_t total = fMinSize * 64;
37 37
38 SkChunkAlloc alloc(fMinSize); 38 SkChunkAlloc alloc(fMinSize);
39 39
40 for (int i = 0; i < loops; ++i) { 40 for (int i = 0; i < loops; ++i) {
41 size_t size = 0; 41 size_t size = 0;
42 int calls = 0; 42 int calls = 0;
43 while (size < total) { 43 while (size < total) {
44 alloc.allocThrow(inc); 44 alloc.allocThrow(inc);
45 size += inc; 45 size += inc;
46 calls += 1; 46 calls += 1;
47 } 47 }
48 alloc.reset(); 48 alloc.reset();
49 } 49 }
50 } 50 }
51 51
52 private: 52 private:
53 typedef Benchmark INHERITED; 53 typedef Benchmark INHERITED;
54 }; 54 };
55 55
56 DEF_BENCH( return new ChunkAllocBench(64); ) 56 DEF_BENCH( return new ChunkAllocBench(64); )
57 DEF_BENCH( return new ChunkAllocBench(8*1024); ) 57 DEF_BENCH( return new ChunkAllocBench(8*1024); )
58 58
OLDNEW
« no previous file with comments | « bench/MatrixConvolutionBench.cpp ('k') | bench/MemsetBench.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698