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

Side by Side Diff: content/app/content_main_runner.cc

Issue 1177853003: [Startup Tracing] Enable startup tracing from config file (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 years, 6 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 | « content/app/android/library_loader_hooks.cc ('k') | content/child/BUILD.gn » ('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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "content/public/app/content_main_runner.h" 5 #include "content/public/app/content_main_runner.h"
6 6
7 #include <stdlib.h> 7 #include <stdlib.h>
8 8
9 #include "base/allocator/allocator_extension.h" 9 #include "base/allocator/allocator_extension.h"
10 #include "base/at_exit.h" 10 #include "base/at_exit.h"
11 #include "base/command_line.h" 11 #include "base/command_line.h"
12 #include "base/debug/debugger.h" 12 #include "base/debug/debugger.h"
13 #include "base/files/file_path.h" 13 #include "base/files/file_path.h"
14 #include "base/i18n/icu_util.h" 14 #include "base/i18n/icu_util.h"
15 #include "base/lazy_instance.h" 15 #include "base/lazy_instance.h"
16 #include "base/logging.h" 16 #include "base/logging.h"
17 #include "base/memory/scoped_ptr.h" 17 #include "base/memory/scoped_ptr.h"
18 #include "base/memory/scoped_vector.h" 18 #include "base/memory/scoped_vector.h"
19 #include "base/metrics/statistics_recorder.h" 19 #include "base/metrics/statistics_recorder.h"
20 #include "base/path_service.h" 20 #include "base/path_service.h"
21 #include "base/process/launch.h" 21 #include "base/process/launch.h"
22 #include "base/process/memory.h" 22 #include "base/process/memory.h"
23 #include "base/process/process_handle.h" 23 #include "base/process/process_handle.h"
24 #include "base/profiler/alternate_timer.h" 24 #include "base/profiler/alternate_timer.h"
25 #include "base/profiler/scoped_tracker.h" 25 #include "base/profiler/scoped_tracker.h"
26 #include "base/strings/string_number_conversions.h" 26 #include "base/strings/string_number_conversions.h"
27 #include "base/strings/string_util.h" 27 #include "base/strings/string_util.h"
28 #include "base/strings/stringprintf.h" 28 #include "base/strings/stringprintf.h"
29 #include "base/trace_event/trace_event.h" 29 #include "base/trace_event/trace_event.h"
30 #include "components/tracing/startup_tracing.h"
30 #include "content/browser/browser_main.h" 31 #include "content/browser/browser_main.h"
31 #include "content/common/set_process_title.h" 32 #include "content/common/set_process_title.h"
32 #include "content/common/url_schemes.h" 33 #include "content/common/url_schemes.h"
33 #include "content/gpu/in_process_gpu_thread.h" 34 #include "content/gpu/in_process_gpu_thread.h"
34 #include "content/public/app/content_main.h" 35 #include "content/public/app/content_main.h"
35 #include "content/public/app/content_main_delegate.h" 36 #include "content/public/app/content_main_delegate.h"
36 #include "content/public/app/startup_helper_win.h" 37 #include "content/public/app/startup_helper_win.h"
37 #include "content/public/browser/content_browser_client.h" 38 #include "content/public/browser/content_browser_client.h"
38 #include "content/public/common/content_client.h" 39 #include "content/public/common/content_client.h"
39 #include "content/public/common/content_constants.h" 40 #include "content/public/common/content_constants.h"
(...skipping 584 matching lines...) Expand 10 before | Expand all | Expand 10 after
624 625
625 // Enable startup tracing asap to avoid early TRACE_EVENT calls being 626 // Enable startup tracing asap to avoid early TRACE_EVENT calls being
626 // ignored. 627 // ignored.
627 if (command_line.HasSwitch(switches::kTraceStartup)) { 628 if (command_line.HasSwitch(switches::kTraceStartup)) {
628 base::trace_event::TraceConfig trace_config( 629 base::trace_event::TraceConfig trace_config(
629 command_line.GetSwitchValueASCII(switches::kTraceStartup), 630 command_line.GetSwitchValueASCII(switches::kTraceStartup),
630 base::trace_event::RECORD_UNTIL_FULL); 631 base::trace_event::RECORD_UNTIL_FULL);
631 base::trace_event::TraceLog::GetInstance()->SetEnabled( 632 base::trace_event::TraceLog::GetInstance()->SetEnabled(
632 trace_config, 633 trace_config,
633 base::trace_event::TraceLog::RECORDING_MODE); 634 base::trace_event::TraceLog::RECORDING_MODE);
635 } else if (process_type != switches::kZygoteProcess) {
636 // There is no need to schedule stopping tracing in this case. Telemetry
637 // will stop tracing on demand later.
638 tracing::EnableStartupTracingIfConfigFileExists();
634 } 639 }
640
635 #if defined(OS_WIN) 641 #if defined(OS_WIN)
636 // Enable exporting of events to ETW if requested on the command line. 642 // Enable exporting of events to ETW if requested on the command line.
637 if (command_line.HasSwitch(switches::kTraceExportEventsToETW)) 643 if (command_line.HasSwitch(switches::kTraceExportEventsToETW))
638 base::trace_event::TraceEventETWExport::EnableETWExport(); 644 base::trace_event::TraceEventETWExport::EnableETWExport();
639 #endif // OS_WIN 645 #endif // OS_WIN
640 646
641 #if !defined(OS_ANDROID) 647 #if !defined(OS_ANDROID)
642 // Android tracing started at the beginning of the method. 648 // Android tracing started at the beginning of the method.
643 // Other OSes have to wait till we get here in order for all the memory 649 // Other OSes have to wait till we get here in order for all the memory
644 // management setup to be completed. 650 // management setup to be completed.
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
861 867
862 DISALLOW_COPY_AND_ASSIGN(ContentMainRunnerImpl); 868 DISALLOW_COPY_AND_ASSIGN(ContentMainRunnerImpl);
863 }; 869 };
864 870
865 // static 871 // static
866 ContentMainRunner* ContentMainRunner::Create() { 872 ContentMainRunner* ContentMainRunner::Create() {
867 return new ContentMainRunnerImpl(); 873 return new ContentMainRunnerImpl();
868 } 874 }
869 875
870 } // namespace content 876 } // namespace content
OLDNEW
« no previous file with comments | « content/app/android/library_loader_hooks.cc ('k') | content/child/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698