1/*
2 * Copyright 2011 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7#include "Benchmark.h"
8#include "SkThread.h"
9
10class MutexBench : public Benchmark {
11public:
12    virtual bool isSuitableFor(Backend backend) SK_OVERRIDE {
13        return backend == kNonRendering_Backend;
14    }
15
16protected:
17    virtual const char* onGetName() {
18        return "mutex";
19    }
20
21    virtual void onDraw(const int loops, SkCanvas*) {
22        SkMutex mu;
23        for (int i = 0; i < loops; i++) {
24            mu.acquire();
25            mu.release();
26        }
27    }
28
29private:
30    typedef Benchmark INHERITED;
31};
32
33///////////////////////////////////////////////////////////////////////////////
34
35DEF_BENCH( return new MutexBench(); )
36