skia2/bench/MutexBench.cpp
mtklein@google.com 410e6e80f0 Refactoring: get rid of the SkBenchmark void* parameter.
While I was doing massive sed-ing, I also converted every bench to use DEF_BENCH instead of registering the ugly manual way.

BUG=
R=scroggo@google.com

Review URL: https://codereview.chromium.org/23876006

git-svn-id: http://skia.googlecode.com/svn/trunk@11263 2bbb7eff-a529-9590-31e7-b0007b416f81
2013-09-13 19:52:27 +00:00

35 lines
739 B
C++

/*
* Copyright 2011 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include "SkBenchmark.h"
#include "SkThread.h"
class MutexBench : public SkBenchmark {
public:
MutexBench() {
fIsRendering = false;
}
protected:
virtual const char* onGetName() {
return "mutex";
}
virtual void onDraw(SkCanvas*) {
SK_DECLARE_STATIC_MUTEX(mu);
for (int i = 0; i < this->getLoops(); i++) {
mu.acquire();
mu.release();
}
}
private:
typedef SkBenchmark INHERITED;
};
///////////////////////////////////////////////////////////////////////////////
DEF_BENCH( return new MutexBench(); )