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

Side by Side Diff: bench/WriterBench.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 | « bench/SortBench.cpp ('k') | bench/XfermodeBench.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 /* 2 /*
3 * Copyright 2012 The Android Open Source Project 3 * Copyright 2012 The Android Open Source Project
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 #include "SkBenchmark.h" 9 #include "SkBenchmark.h"
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
11 #include "SkWriter32.h" 11 #include "SkWriter32.h"
12 12
13 class WriterBench : public SkBenchmark { 13 class WriterBench : public SkBenchmark {
14 public: 14 public:
15 WriterBench() { fIsRendering = false; } 15 virtual bool isSuitableFor(Backend backend) SK_OVERRIDE {
16 return backend == kNonRendering_Backend;
17 }
16 18
17 protected: 19 protected:
18 virtual const char* onGetName() SK_OVERRIDE { 20 virtual const char* onGetName() SK_OVERRIDE {
19 return "writer"; 21 return "writer";
20 } 22 }
21 23
22 virtual void onDraw(SkCanvas*) SK_OVERRIDE { 24 virtual void onDraw(SkCanvas*) SK_OVERRIDE {
23 static const char gStr[] = "abcdefghimjklmnopqrstuvwxyz"; 25 static const char gStr[] = "abcdefghimjklmnopqrstuvwxyz";
24 static const size_t gLen = strlen(gStr); 26 static const size_t gLen = strlen(gStr);
25 SkWriter32 writer(256 * 4); 27 SkWriter32 writer(256 * 4);
26 for (int i = 0; i < this->getLoops(); i++) { 28 for (int i = 0; i < this->getLoops(); i++) {
27 for (size_t j = 0; j <= gLen; j++) { 29 for (size_t j = 0; j <= gLen; j++) {
28 writer.writeString(gStr, j); 30 writer.writeString(gStr, j);
29 } 31 }
30 } 32 }
31 } 33 }
32 34
33 private: 35 private:
34 typedef SkBenchmark INHERITED; 36 typedef SkBenchmark INHERITED;
35 }; 37 };
36 38
37 //////////////////////////////////////////////////////////////////////////////// 39 ////////////////////////////////////////////////////////////////////////////////
38 40
39 DEF_BENCH( return new WriterBench(); ) 41 DEF_BENCH( return new WriterBench(); )
OLDNEW
« no previous file with comments | « bench/SortBench.cpp ('k') | bench/XfermodeBench.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698