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

Side by Side Diff: base/test/perf_test_suite.h

Issue 3035062: Revert 55400 - Cleanup in base. This moves the implementation (and a bunch of... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 10 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « base/test/multiprocess_test.cc ('k') | base/test/perf_test_suite.cc » ('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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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_TEST_PERF_TEST_SUITE_H_ 5 #ifndef BASE_TEST_PERF_TEST_SUITE_H_
6 #define BASE_TEST_PERF_TEST_SUITE_H_ 6 #define BASE_TEST_PERF_TEST_SUITE_H_
7 #pragma once 7 #pragma once
8 8
9 #include "base/basictypes.h" 9 #include "base/command_line.h"
10 #include "base/debug_util.h"
11 #include "base/file_path.h"
12 #include "base/perftimer.h"
13 #include "base/process_util.h"
14 #include "base/string_util.h"
10 #include "base/test/test_suite.h" 15 #include "base/test/test_suite.h"
11 16
12 namespace base {
13
14 class PerfTestSuite : public TestSuite { 17 class PerfTestSuite : public TestSuite {
15 public: 18 public:
16 PerfTestSuite(int argc, char** argv); 19 PerfTestSuite(int argc, char** argv) : TestSuite(argc, argv) {
20 }
17 21
18 virtual void Initialize(); 22 virtual void Initialize() {
19 virtual void Shutdown(); 23 TestSuite::Initialize();
20 24
21 private: 25 // Initialize the perf timer log
22 DISALLOW_COPY_AND_ASSIGN(PerfTestSuite); 26 FilePath log_path =
27 CommandLine::ForCurrentProcess()->GetSwitchValuePath("log-file");
28 if (log_path.empty()) {
29 FilePath exe;
30 PathService::Get(base::FILE_EXE, &exe);
31 log_path = exe.ReplaceExtension(FILE_PATH_LITERAL("log"));
32 log_path = log_path.InsertBeforeExtension(FILE_PATH_LITERAL("_perf"));
33 }
34 ASSERT_TRUE(InitPerfLog(log_path));
35
36 // Raise to high priority to have more precise measurements. Since we don't
37 // aim at 1% precision, it is not necessary to run at realtime level.
38 if (!DebugUtil::BeingDebugged())
39 base::RaiseProcessToHighPriority();
40 }
41
42 virtual void Shutdown() {
43 TestSuite::Shutdown();
44
45 FinalizePerfLog();
46 }
23 }; 47 };
24 48
25 } // namespace base
26
27 #endif // BASE_TEST_PERF_TEST_SUITE_H_ 49 #endif // BASE_TEST_PERF_TEST_SUITE_H_
OLDNEW
« no previous file with comments | « base/test/multiprocess_test.cc ('k') | base/test/perf_test_suite.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698