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

Side by Side Diff: bench/MutexBench.cpp

Issue 23478013: Major bench refactoring. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: merge with head agani Created 7 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « bench/MorphologyBench.cpp ('k') | bench/PathBench.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 2011 Google Inc. 2 * Copyright 2011 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 "SkThread.h" 8 #include "SkThread.h"
9 9
10 class MutexBench : public SkBenchmark { 10 class MutexBench : public SkBenchmark {
11 enum {
12 N = SkBENCHLOOP(80),
13 M = SkBENCHLOOP(200)
14 };
15 public: 11 public:
16 MutexBench(void* param) : INHERITED(param) { 12 MutexBench(void* param) : INHERITED(param) {
17 fIsRendering = false; 13 fIsRendering = false;
18 } 14 }
19 protected: 15 protected:
20 virtual const char* onGetName() { 16 virtual const char* onGetName() {
21 return "mutex"; 17 return "mutex";
22 } 18 }
23 19
24 virtual void onDraw(SkCanvas*) { 20 virtual void onDraw(SkCanvas*) {
25 for (int i = 0; i < N; i++) { 21 SK_DECLARE_STATIC_MUTEX(mu);
26 SK_DECLARE_STATIC_MUTEX(mu); 22 for (int i = 0; i < this->getLoops(); i++) {
27 for (int j = 0; j < M; j++) { 23 mu.acquire();
28 mu.acquire(); 24 mu.release();
29 mu.release();
30 }
31 } 25 }
32 } 26 }
33 27
34 private: 28 private:
35 typedef SkBenchmark INHERITED; 29 typedef SkBenchmark INHERITED;
36 }; 30 };
37 31
38 /////////////////////////////////////////////////////////////////////////////// 32 ///////////////////////////////////////////////////////////////////////////////
39 33
40 static SkBenchmark* Fact(void* p) { return new MutexBench(p); } 34 static SkBenchmark* Fact(void* p) { return new MutexBench(p); }
41 35
42 static BenchRegistry gReg01(Fact); 36 static BenchRegistry gReg01(Fact);
OLDNEW
« no previous file with comments | « bench/MorphologyBench.cpp ('k') | bench/PathBench.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698