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

Side by Side Diff: content/app/android/library_loader_hooks.cc

Issue 1177853003: [Startup Tracing] Enable startup tracing from config file (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review fix 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
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/app/android/library_loader_hooks.h" 5 #include "content/app/android/library_loader_hooks.h"
6 6
7 #include "base/android/base_jni_registrar.h" 7 #include "base/android/base_jni_registrar.h"
8 #include "base/android/command_line_android.h" 8 #include "base/android/command_line_android.h"
9 #include "base/android/jni_android.h" 9 #include "base/android/jni_android.h"
10 #include "base/android/jni_registrar.h" 10 #include "base/android/jni_registrar.h"
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 } 88 }
89 89
90 bool LibraryLoaded(JNIEnv* env, jclass clazz) { 90 bool LibraryLoaded(JNIEnv* env, jclass clazz) {
91 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); 91 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
92 92
93 if (command_line->HasSwitch(switches::kTraceStartup)) { 93 if (command_line->HasSwitch(switches::kTraceStartup)) {
94 base::trace_event::TraceConfig trace_config( 94 base::trace_event::TraceConfig trace_config(
95 command_line->GetSwitchValueASCII(switches::kTraceStartup), ""); 95 command_line->GetSwitchValueASCII(switches::kTraceStartup), "");
96 base::trace_event::TraceLog::GetInstance()->SetEnabled( 96 base::trace_event::TraceLog::GetInstance()->SetEnabled(
97 trace_config, base::trace_event::TraceLog::RECORDING_MODE); 97 trace_config, base::trace_event::TraceLog::RECORDING_MODE);
98 } else {
99 base::trace_event::EnableStartupTracingIfConfigFileExists();
98 } 100 }
99 101
100 // Android's main browser loop is custom so we set the browser 102 // Android's main browser loop is custom so we set the browser
101 // name here as early as possible. 103 // name here as early as possible.
102 TRACE_EVENT_BEGIN_ETW("BrowserMain", 0, ""); 104 TRACE_EVENT_BEGIN_ETW("BrowserMain", 0, "");
103 base::trace_event::TraceLog::GetInstance()->SetProcessName("Browser"); 105 base::trace_event::TraceLog::GetInstance()->SetProcessName("Browser");
104 base::trace_event::TraceLog::GetInstance()->SetProcessSortIndex( 106 base::trace_event::TraceLog::GetInstance()->SetProcessSortIndex(
105 kTraceEventBrowserProcessSortIndex); 107 kTraceEventBrowserProcessSortIndex);
106 108
107 // Can only use event tracing after setting up the command line. 109 // Can only use event tracing after setting up the command line.
108 TRACE_EVENT0("jni", "JNI_OnLoad continuation"); 110 TRACE_EVENT0("jni", "JNI_OnLoad continuation");
109 111
110 logging::LoggingSettings settings; 112 logging::LoggingSettings settings;
111 settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG; 113 settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG;
112 logging::InitLogging(settings); 114 logging::InitLogging(settings);
113 // To view log output with IDs and timestamps use "adb logcat -v threadtime". 115 // To view log output with IDs and timestamps use "adb logcat -v threadtime".
114 logging::SetLogItems(false, // Process ID 116 logging::SetLogItems(false, // Process ID
115 false, // Thread ID 117 false, // Thread ID
116 false, // Timestamp 118 false, // Timestamp
117 false); // Tick count 119 false); // Tick count
118 VLOG(0) << "Chromium logging enabled: level = " << logging::GetMinLogLevel() 120 VLOG(0) << "Chromium logging enabled: level = " << logging::GetMinLogLevel()
119 << ", default verbosity = " << logging::GetVlogVerbosity(); 121 << ", default verbosity = " << logging::GetVlogVerbosity();
120 122
121 return true; 123 return true;
122 } 124 }
123 125
124 } // namespace content 126 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698