| OLD | NEW | 
|   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 public: |  11 public: | 
|  12     MutexBench()  { |  12     virtual bool isSuitableFor(Backend backend) SK_OVERRIDE { | 
|  13         fIsRendering = false; |  13         return backend == kNonRendering_Backend; | 
|  14     } |  14     } | 
 |  15  | 
|  15 protected: |  16 protected: | 
|  16     virtual const char* onGetName() { |  17     virtual const char* onGetName() { | 
|  17         return "mutex"; |  18         return "mutex"; | 
|  18     } |  19     } | 
|  19  |  20  | 
|  20     virtual void onDraw(SkCanvas*) { |  21     virtual void onDraw(SkCanvas*) { | 
|  21         SK_DECLARE_STATIC_MUTEX(mu); |  22         SK_DECLARE_STATIC_MUTEX(mu); | 
|  22         for (int i = 0; i < this->getLoops(); i++) { |  23         for (int i = 0; i < this->getLoops(); i++) { | 
|  23             mu.acquire(); |  24             mu.acquire(); | 
|  24             mu.release(); |  25             mu.release(); | 
|  25         } |  26         } | 
|  26     } |  27     } | 
|  27  |  28  | 
|  28 private: |  29 private: | 
|  29     typedef SkBenchmark INHERITED; |  30     typedef SkBenchmark INHERITED; | 
|  30 }; |  31 }; | 
|  31  |  32  | 
|  32 /////////////////////////////////////////////////////////////////////////////// |  33 /////////////////////////////////////////////////////////////////////////////// | 
|  33  |  34  | 
|  34 DEF_BENCH( return new MutexBench(); ) |  35 DEF_BENCH( return new MutexBench(); ) | 
| OLD | NEW |