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/perf_test_suite.h" |
6 #include "base/debug_util.h" | |
7 #include "base/perftimer.h" | |
8 #include "base/process_util.h" | |
9 #include "base/string_util.h" | |
10 #include "base/test_suite.h" | |
11 | |
12 class PerfTestSuite : public TestSuite { | |
13 public: | |
14 PerfTestSuite(int argc, char** argv) : TestSuite(argc, argv) { | |
15 } | |
16 | |
17 virtual void Initialize() { | |
18 // Initialize the perf timer log | |
19 std::string log_file = | |
20 WideToUTF8(CommandLine().GetSwitchValue(L"log-file")); | |
21 if (log_file.empty()) | |
22 log_file = "perf_test.log"; | |
23 ASSERT_TRUE(InitPerfLog(log_file.c_str())); | |
24 | |
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. | |
27 if (!DebugUtil::BeingDebugged()) | |
28 base::RaiseProcessToHighPriority(); | |
29 | |
30 TestSuite::Initialize(); | |
31 } | |
32 | |
33 virtual void Shutdown() { | |
34 TestSuite::Shutdown(); | |
35 | |
36 FinalizePerfLog(); | |
37 } | |
38 }; | |
39 | 6 |
40 int main(int argc, char** argv) { | 7 int main(int argc, char** argv) { |
41 return PerfTestSuite(argc, argv).Run(); | 8 return PerfTestSuite(argc, argv).Run(); |
42 } | 9 } |
OLD | NEW |