Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(436)

Side by Side Diff: base/perf_test_suite.h

Issue 18248: CommandLine API rework (Closed)
Patch Set: fixes Created 11 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « base/multiprocess_test.h ('k') | base/process_util.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #ifndef BASE_PERF_TEST_SUITE_H_ 5 #ifndef BASE_PERF_TEST_SUITE_H_
6 #define BASE_PERF_TEST_SUITE_H_ 6 #define BASE_PERF_TEST_SUITE_H_
7 7
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/debug_util.h" 9 #include "base/debug_util.h"
10 #include "base/file_path.h" 10 #include "base/file_path.h"
11 #include "base/perftimer.h" 11 #include "base/perftimer.h"
12 #include "base/process_util.h" 12 #include "base/process_util.h"
13 #include "base/string_util.h" 13 #include "base/string_util.h"
14 #include "base/test_suite.h" 14 #include "base/test_suite.h"
15 15
16 class PerfTestSuite : public TestSuite { 16 class PerfTestSuite : public TestSuite {
17 public: 17 public:
18 PerfTestSuite(int argc, char** argv) : TestSuite(argc, argv) { 18 PerfTestSuite(int argc, char** argv) : TestSuite(argc, argv) {
19 } 19 }
20 20
21 virtual void Initialize() { 21 virtual void Initialize() {
22 TestSuite::Initialize(); 22 TestSuite::Initialize();
23 23
24 // Initialize the perf timer log 24 // Initialize the perf timer log
25 FilePath log_path; 25 FilePath log_path;
26 std::wstring log_file = CommandLine().GetSwitchValue(L"log-file"); 26 std::wstring log_file =
27 CommandLine::ForCurrentProcess()->GetSwitchValue(L"log-file");
27 if (log_file.empty()) { 28 if (log_file.empty()) {
28 FilePath exe; 29 FilePath exe;
29 PathService::Get(base::FILE_EXE, &exe); 30 PathService::Get(base::FILE_EXE, &exe);
30 log_path = exe.ReplaceExtension(FILE_PATH_LITERAL("log")); 31 log_path = exe.ReplaceExtension(FILE_PATH_LITERAL("log"));
31 log_path = log_path.InsertBeforeExtension(FILE_PATH_LITERAL("_perf")); 32 log_path = log_path.InsertBeforeExtension(FILE_PATH_LITERAL("_perf"));
32 } else { 33 } else {
33 log_path = FilePath::FromWStringHack(log_file); 34 log_path = FilePath::FromWStringHack(log_file);
34 } 35 }
35 ASSERT_TRUE(InitPerfLog(log_path)); 36 ASSERT_TRUE(InitPerfLog(log_path));
36 37
37 // Raise to high priority to have more precise measurements. Since we don't 38 // Raise to high priority to have more precise measurements. Since we don't
38 // aim at 1% precision, it is not necessary to run at realtime level. 39 // aim at 1% precision, it is not necessary to run at realtime level.
39 if (!DebugUtil::BeingDebugged()) 40 if (!DebugUtil::BeingDebugged())
40 base::RaiseProcessToHighPriority(); 41 base::RaiseProcessToHighPriority();
41 } 42 }
42 43
43 virtual void Shutdown() { 44 virtual void Shutdown() {
44 TestSuite::Shutdown(); 45 TestSuite::Shutdown();
45 46
46 FinalizePerfLog(); 47 FinalizePerfLog();
47 } 48 }
48 }; 49 };
49 50
50 #endif // BASE_PERF_TEST_SUITE_H_ 51 #endif // BASE_PERF_TEST_SUITE_H_
OLDNEW
« no previous file with comments | « base/multiprocess_test.h ('k') | base/process_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698