OLD | NEW |
1 // Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium OS Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "main.h" | 5 #include "main.h" |
6 #include "testbase.h" | 6 #include "testbase.h" |
7 | 7 |
8 | 8 |
9 namespace glbench { | 9 namespace glbench { |
10 | 10 |
11 | 11 |
12 class SwapTest : public TestBase { | 12 class SwapTest : public TestBase { |
13 public: | 13 public: |
14 SwapTest() {} | 14 SwapTest() {} |
15 virtual ~SwapTest() {} | 15 virtual ~SwapTest() {} |
16 virtual bool TestFunc(int iter); | 16 virtual bool TestFunc(int iter); |
17 virtual bool Run(); | 17 virtual bool Run(); |
| 18 virtual const char* Name() const { return "swap"; } |
18 | 19 |
19 private: | 20 private: |
20 DISALLOW_COPY_AND_ASSIGN(SwapTest); | 21 DISALLOW_COPY_AND_ASSIGN(SwapTest); |
21 }; | 22 }; |
22 | 23 |
23 | 24 |
24 bool SwapTest::TestFunc(int iter) { | 25 bool SwapTest::TestFunc(int iter) { |
25 for (int i = 0 ; i < iter; ++i) { | 26 for (int i = 0 ; i < iter; ++i) { |
26 SwapBuffers(); | 27 SwapBuffers(); |
27 } | 28 } |
28 return true; | 29 return true; |
29 } | 30 } |
30 | 31 |
31 | 32 |
32 bool SwapTest::Run() { | 33 bool SwapTest::Run() { |
33 RunTest(this, "us_swap_swap", 1.f, false); | 34 RunTest(this, "us_swap_swap", 1.f, false); |
34 return true; | 35 return true; |
35 } | 36 } |
36 | 37 |
37 | 38 |
38 TestBase* GetSwapTest() { | 39 TestBase* GetSwapTest() { |
39 return new SwapTest; | 40 return new SwapTest; |
40 } | 41 } |
41 | 42 |
42 } // namespace glbench | 43 } // namespace glbench |
OLD | NEW |