OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 The Chromium 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 "base/command_line.h" | 5 #include "base/command_line.h" |
6 #include "base/debug_util.h" | 6 #include "base/debug_util.h" |
7 #include "base/perftimer.h" | 7 #include "base/perftimer.h" |
8 #include "base/process_util.h" | 8 #include "base/process_util.h" |
9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
10 #include "base/test_suite.h" | 10 #include "base/test_suite.h" |
11 | 11 |
12 class PerfTestSuite : public TestSuite { | 12 class PerfTestSuite : public TestSuite { |
13 public: | 13 public: |
14 PerfTestSuite(int argc, char** argv) : TestSuite(argc, argv) { | 14 PerfTestSuite(int argc, char** argv) : TestSuite(argc, argv) { |
15 } | 15 } |
16 | 16 |
17 virtual void Initialize() { | 17 virtual void Initialize() { |
18 // Initialize the perf timer log | 18 // Initialize the perf timer log |
19 std::string log_file = | 19 std::string log_file = |
20 WideToUTF8(CommandLine().GetSwitchValue(L"log-file")); | 20 WideToUTF8(CommandLine().GetSwitchValue(L"log-file")); |
21 if (log_file.empty()) | 21 if (log_file.empty()) |
22 log_file = "perf_test.log"; | 22 log_file = "perf_test.log"; |
23 ASSERT_TRUE(InitPerfLog(log_file.c_str())); | 23 ASSERT_TRUE(InitPerfLog(log_file.c_str())); |
24 | 24 |
25 // Raise to high priority to have more precise measurements. Since we don't | 25 // Raise to high priority to have more precise measurements. Since we don't |
26 // aim at 1% precision, it is not necessary to run at realtime level. | 26 // aim at 1% precision, it is not necessary to run at realtime level. |
27 if (!DebugUtil::BeingDebugged()) | 27 if (!DebugUtil::BeingDebugged()) |
28 process_util::RaiseProcessToHighPriority(); | 28 base::RaiseProcessToHighPriority(); |
29 | 29 |
30 TestSuite::Initialize(); | 30 TestSuite::Initialize(); |
31 } | 31 } |
32 | 32 |
33 virtual void Shutdown() { | 33 virtual void Shutdown() { |
34 TestSuite::Shutdown(); | 34 TestSuite::Shutdown(); |
35 | 35 |
36 FinalizePerfLog(); | 36 FinalizePerfLog(); |
37 } | 37 } |
38 }; | 38 }; |
39 | 39 |
40 int main(int argc, char** argv) { | 40 int main(int argc, char** argv) { |
41 return PerfTestSuite(argc, argv).Run(); | 41 return PerfTestSuite(argc, argv).Run(); |
42 } | 42 } |
OLD | NEW |