OLD | NEW |
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 "chrome/browser/chrome_browser_main.h" | 5 #include "chrome/browser/chrome_browser_main.h" |
6 | 6 |
7 #if defined(TOOLKIT_GTK) | 7 #if defined(TOOLKIT_GTK) |
8 #include <gtk/gtk.h> | 8 #include <gtk/gtk.h> |
9 #endif | 9 #endif |
10 | 10 |
11 #include <string> | 11 #include <string> |
12 #include <vector> | 12 #include <vector> |
13 | 13 |
14 #include "base/at_exit.h" | 14 #include "base/at_exit.h" |
15 #include "base/bind.h" | 15 #include "base/bind.h" |
16 #include "base/command_line.h" | 16 #include "base/command_line.h" |
| 17 #include "base/cpu.h" |
17 #include "base/debug/trace_event.h" | 18 #include "base/debug/trace_event.h" |
18 #include "base/file_path.h" | 19 #include "base/file_path.h" |
19 #include "base/file_util.h" | 20 #include "base/file_util.h" |
20 #include "base/metrics/field_trial.h" | 21 #include "base/metrics/field_trial.h" |
21 #include "base/metrics/histogram.h" | 22 #include "base/metrics/histogram.h" |
22 #include "base/path_service.h" | 23 #include "base/path_service.h" |
23 #include "base/prefs/json_pref_store.h" | 24 #include "base/prefs/json_pref_store.h" |
24 #include "base/process_info.h" | 25 #include "base/process_info.h" |
25 #include "base/process_util.h" | 26 #include "base/process_util.h" |
26 #include "base/run_loop.h" | 27 #include "base/run_loop.h" |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 #endif | 201 #endif |
201 | 202 |
202 #if defined(USE_X11) | 203 #if defined(USE_X11) |
203 #include "chrome/browser/chrome_browser_main_x11.h" | 204 #include "chrome/browser/chrome_browser_main_x11.h" |
204 #endif | 205 #endif |
205 | 206 |
206 using content::BrowserThread; | 207 using content::BrowserThread; |
207 | 208 |
208 namespace { | 209 namespace { |
209 | 210 |
| 211 void LogIntelMicroArchitecture() { |
| 212 base::CPU cpu; |
| 213 base::CPU::IntelMicroArchitecture arch = cpu.GetIntelMicroArchitecture(); |
| 214 UMA_HISTOGRAM_ENUMERATION("Platform.IntelMaxMicroArchitecture", arch, |
| 215 base::CPU::MAX_INTEL_MICRO_ARCHITECTURE); |
| 216 } |
| 217 |
210 // This function provides some ways to test crash and assertion handling | 218 // This function provides some ways to test crash and assertion handling |
211 // behavior of the program. | 219 // behavior of the program. |
212 void HandleTestParameters(const CommandLine& command_line) { | 220 void HandleTestParameters(const CommandLine& command_line) { |
213 // This parameter causes an assertion. | 221 // This parameter causes an assertion. |
214 if (command_line.HasSwitch(switches::kBrowserAssertTest)) { | 222 if (command_line.HasSwitch(switches::kBrowserAssertTest)) { |
215 DCHECK(false); | 223 DCHECK(false); |
216 } | 224 } |
217 | 225 |
218 // This parameter causes a null pointer crash (crash reporter trigger). | 226 // This parameter causes a null pointer crash (crash reporter trigger). |
219 if (command_line.HasSwitch(switches::kBrowserCrashTest)) { | 227 if (command_line.HasSwitch(switches::kBrowserCrashTest)) { |
(...skipping 802 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1022 } | 1030 } |
1023 | 1031 |
1024 int ChromeBrowserMainParts::PreMainMessageLoopRunImpl() { | 1032 int ChromeBrowserMainParts::PreMainMessageLoopRunImpl() { |
1025 // Android updates the metrics service dynamically depending on whether the | 1033 // Android updates the metrics service dynamically depending on whether the |
1026 // application is in the foreground or not. Do not start here. | 1034 // application is in the foreground or not. Do not start here. |
1027 #if !defined(OS_ANDROID) | 1035 #if !defined(OS_ANDROID) |
1028 // Now that the file thread has been started, start recording. | 1036 // Now that the file thread has been started, start recording. |
1029 StartMetricsRecording(); | 1037 StartMetricsRecording(); |
1030 #endif | 1038 #endif |
1031 | 1039 |
| 1040 #if defined(ARCH_CPU_X86_FAMILY) |
| 1041 LogIntelMicroArchitecture(); |
| 1042 #endif // defined(ARCH_CPU_X86_FAMILY) |
| 1043 |
1032 // Create watchdog thread after creating all other threads because it will | 1044 // Create watchdog thread after creating all other threads because it will |
1033 // watch the other threads and they must be running. | 1045 // watch the other threads and they must be running. |
1034 browser_process_->watchdog_thread(); | 1046 browser_process_->watchdog_thread(); |
1035 | 1047 |
1036 // Do any initializating in the browser process that requires all threads | 1048 // Do any initializating in the browser process that requires all threads |
1037 // running. | 1049 // running. |
1038 browser_process_->PreMainMessageLoopRun(); | 1050 browser_process_->PreMainMessageLoopRun(); |
1039 | 1051 |
1040 // Record last shutdown time into a histogram. | 1052 // Record last shutdown time into a histogram. |
1041 browser_shutdown::ReadLastShutdownInfo(); | 1053 browser_shutdown::ReadLastShutdownInfo(); |
(...skipping 675 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1717 if (base::win::GetVersion() <= base::win::VERSION_XP) | 1729 if (base::win::GetVersion() <= base::win::VERSION_XP) |
1718 uma_name += "_XP"; | 1730 uma_name += "_XP"; |
1719 | 1731 |
1720 uma_name += "_PreRead_"; | 1732 uma_name += "_PreRead_"; |
1721 uma_name += pre_read_percentage; | 1733 uma_name += pre_read_percentage; |
1722 AddPreReadHistogramTime(uma_name.c_str(), time); | 1734 AddPreReadHistogramTime(uma_name.c_str(), time); |
1723 } | 1735 } |
1724 #endif | 1736 #endif |
1725 #endif | 1737 #endif |
1726 } | 1738 } |
OLD | NEW |