OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #include "components/tracing/common/startup_command_parser.h" | |
6 | |
7 #include "base/logging.h" | |
8 #include "base/trace_event/memory_dump_manager.h" | |
9 #include "base/trace_event/trace_log.h" | |
10 #include "components/tracing/common/trace_config_file.h" | |
11 #include "components/tracing/common/trace_to_console.h" | |
12 #include "components/tracing/common/tracing_switches.h" | |
13 | |
14 namespace tracing { | |
15 | |
16 void ParseStartupTraceCommands(const base::CommandLine& command_line, | |
Zhen Wang
2017/02/10 19:56:01
This function name does not capture what it actual
ssid
2017/02/11 01:14:17
Renamed as suggested. I'd be happy to rename the f
| |
17 bool can_access_file_system) { | |
18 base::trace_event::MemoryDumpManager::GetInstance() | |
19 ->EnableHeapProfilingIfNeeded(); | |
20 | |
21 if (command_line.HasSwitch(switches::kTraceStartup)) { | |
22 base::trace_event::TraceConfig trace_config( | |
23 command_line.GetSwitchValueASCII(switches::kTraceStartup), | |
24 base::trace_event::RECORD_UNTIL_FULL); | |
25 base::trace_event::TraceLog::GetInstance()->SetEnabled( | |
26 trace_config, base::trace_event::TraceLog::RECORDING_MODE); | |
27 } else if (command_line.HasSwitch(switches::kTraceToConsole)) { | |
28 base::trace_event::TraceConfig trace_config = | |
29 tracing::GetConfigForTraceToConsole(); | |
30 LOG(ERROR) << "Start " << switches::kTraceToConsole | |
31 << " with CategoryFilter '" | |
32 << trace_config.ToCategoryFilterString() << "'."; | |
33 base::trace_event::TraceLog::GetInstance()->SetEnabled( | |
34 trace_config, base::trace_event::TraceLog::RECORDING_MODE); | |
35 } else if (can_access_file_system && | |
36 tracing::TraceConfigFile::GetInstance()->IsEnabled()) { | |
37 // This checks kTraceConfigFile switch. | |
38 base::trace_event::TraceLog::GetInstance()->SetEnabled( | |
39 tracing::TraceConfigFile::GetInstance()->GetTraceConfig(), | |
40 base::trace_event::TraceLog::RECORDING_MODE); | |
41 } | |
42 } | |
43 | |
44 } // namespace tracing | |
OLD | NEW |