Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/metrics/chrome_metrics_service_client.h" | 5 #include "chrome/browser/metrics/chrome_metrics_service_client.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| 11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
| 12 #include "base/files/file_path.h" | 12 #include "base/files/file_path.h" |
| 13 #include "base/logging.h" | 13 #include "base/logging.h" |
| 14 #include "base/metrics/field_trial.h" | 14 #include "base/metrics/field_trial.h" |
| 15 #include "base/metrics/histogram.h" | 15 #include "base/metrics/histogram.h" |
| 16 #include "base/prefs/pref_registry_simple.h" | 16 #include "base/prefs/pref_registry_simple.h" |
| 17 #include "base/prefs/pref_service.h" | 17 #include "base/prefs/pref_service.h" |
| 18 #include "base/strings/string16.h" | 18 #include "base/strings/string16.h" |
| 19 #include "base/strings/string_util.h" | 19 #include "base/strings/string_util.h" |
| 20 #include "base/strings/utf_string_conversions.h" | 20 #include "base/strings/utf_string_conversions.h" |
| 21 #include "base/threading/platform_thread.h" | 21 #include "base/threading/platform_thread.h" |
| 22 #include "chrome/browser/browser_process.h" | 22 #include "chrome/browser/browser_process.h" |
| 23 #include "chrome/browser/chrome_notification_types.h" | 23 #include "chrome/browser/chrome_notification_types.h" |
| 24 #include "chrome/browser/google/google_brand.h" | 24 #include "chrome/browser/google/google_brand.h" |
| 25 #include "chrome/browser/metrics/chrome_stability_metrics_provider.h" | 25 #include "chrome/browser/metrics/chrome_stability_metrics_provider.h" |
| 26 #include "chrome/browser/metrics/drive_metrics_provider.h" | 26 #include "chrome/browser/metrics/drive_metrics_provider.h" |
| 27 #include "chrome/browser/metrics/omnibox_metrics_provider.h" | 27 #include "chrome/browser/metrics/omnibox_metrics_provider.h" |
| 28 #include "chrome/browser/metrics/time_ticks_experiment_win.h" | |
| 28 #include "chrome/browser/ui/browser_otr_state.h" | 29 #include "chrome/browser/ui/browser_otr_state.h" |
| 29 #include "chrome/common/chrome_constants.h" | 30 #include "chrome/common/chrome_constants.h" |
| 30 #include "chrome/common/chrome_switches.h" | 31 #include "chrome/common/chrome_switches.h" |
| 31 #include "chrome/common/chrome_version_info.h" | 32 #include "chrome/common/chrome_version_info.h" |
| 32 #include "chrome/common/crash_keys.h" | 33 #include "chrome/common/crash_keys.h" |
| 33 #include "chrome/common/pref_names.h" | 34 #include "chrome/common/pref_names.h" |
| 34 #include "chrome/common/render_messages.h" | 35 #include "chrome/common/render_messages.h" |
| 35 #include "components/metrics/call_stack_profile_metrics_provider.h" | 36 #include "components/metrics/call_stack_profile_metrics_provider.h" |
| 36 #include "components/metrics/gpu/gpu_metrics_provider.h" | 37 #include "components/metrics/gpu/gpu_metrics_provider.h" |
| 37 #include "components/metrics/metrics_service.h" | 38 #include "components/metrics/metrics_service.h" |
| 38 #include "components/metrics/net/net_metrics_log_uploader.h" | 39 #include "components/metrics/net/net_metrics_log_uploader.h" |
|
ramant (doing other things)
2015/03/25 19:24:27
We could delete #include "components/metrics/net/n
Ilya Sherman
2015/03/25 21:12:03
Done.
| |
| 39 #include "components/metrics/net/network_metrics_provider.h" | 40 #include "components/metrics/net/network_metrics_provider.h" |
| 40 #include "components/metrics/profiler/profiler_metrics_provider.h" | 41 #include "components/metrics/profiler/profiler_metrics_provider.h" |
| 41 #include "components/metrics/profiler/tracking_synchronizer.h" | 42 #include "components/metrics/profiler/tracking_synchronizer.h" |
| 42 #include "components/metrics/url_constants.h" | 43 #include "components/metrics/url_constants.h" |
| 43 #include "content/public/browser/browser_thread.h" | 44 #include "content/public/browser/browser_thread.h" |
| 44 #include "content/public/browser/histogram_fetcher.h" | 45 #include "content/public/browser/histogram_fetcher.h" |
| 45 #include "content/public/browser/notification_service.h" | 46 #include "content/public/browser/notification_service.h" |
| 46 #include "content/public/browser/render_process_host.h" | 47 #include "content/public/browser/render_process_host.h" |
| 47 | 48 |
| 48 #if defined(OS_ANDROID) | 49 #if defined(OS_ANDROID) |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 213 std::string version = version_info.Version(); | 214 std::string version = version_info.Version(); |
| 214 #if defined(ARCH_CPU_64_BITS) | 215 #if defined(ARCH_CPU_64_BITS) |
| 215 version += "-64"; | 216 version += "-64"; |
| 216 #endif // defined(ARCH_CPU_64_BITS) | 217 #endif // defined(ARCH_CPU_64_BITS) |
| 217 if (!version_info.IsOfficialBuild()) | 218 if (!version_info.IsOfficialBuild()) |
| 218 version.append("-devel"); | 219 version.append("-devel"); |
| 219 return version; | 220 return version; |
| 220 } | 221 } |
| 221 | 222 |
| 222 void ChromeMetricsServiceClient::OnLogUploadComplete() { | 223 void ChromeMetricsServiceClient::OnLogUploadComplete() { |
| 223 // Collect network stats after each UMA upload. | 224 // Collect time ticks stats after each UMA upload. |
| 224 network_stats_uploader_.CollectAndReportNetworkStats(); | 225 #if defined(OS_WIN) |
| 226 chrome::CollectTimeTicksStats(); | |
| 227 #endif | |
| 225 } | 228 } |
| 226 | 229 |
| 227 void ChromeMetricsServiceClient::StartGatheringMetrics( | 230 void ChromeMetricsServiceClient::StartGatheringMetrics( |
| 228 const base::Closure& done_callback) { | 231 const base::Closure& done_callback) { |
| 229 finished_gathering_initial_metrics_callback_ = done_callback; | 232 finished_gathering_initial_metrics_callback_ = done_callback; |
| 230 base::Closure got_hardware_class_callback = | 233 base::Closure got_hardware_class_callback = |
| 231 base::Bind(&ChromeMetricsServiceClient::OnInitTaskGotHardwareClass, | 234 base::Bind(&ChromeMetricsServiceClient::OnInitTaskGotHardwareClass, |
| 232 weak_ptr_factory_.GetWeakPtr()); | 235 weak_ptr_factory_.GetWeakPtr()); |
| 233 #if defined(OS_CHROMEOS) | 236 #if defined(OS_CHROMEOS) |
| 234 chromeos_metrics_provider_->InitTaskGetHardwareClass( | 237 chromeos_metrics_provider_->InitTaskGetHardwareClass( |
| (...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 604 // Capture the histogram samples. | 607 // Capture the histogram samples. |
| 605 if (dumps_with_crash != 0) | 608 if (dumps_with_crash != 0) |
| 606 UMA_HISTOGRAM_COUNTS("Chrome.BrowserDumpsWithCrash", dumps_with_crash); | 609 UMA_HISTOGRAM_COUNTS("Chrome.BrowserDumpsWithCrash", dumps_with_crash); |
| 607 if (dumps_with_no_crash != 0) | 610 if (dumps_with_no_crash != 0) |
| 608 UMA_HISTOGRAM_COUNTS("Chrome.BrowserDumpsWithNoCrash", dumps_with_no_crash); | 611 UMA_HISTOGRAM_COUNTS("Chrome.BrowserDumpsWithNoCrash", dumps_with_no_crash); |
| 609 int total_dumps = dumps_with_crash + dumps_with_no_crash; | 612 int total_dumps = dumps_with_crash + dumps_with_no_crash; |
| 610 if (total_dumps != 0) | 613 if (total_dumps != 0) |
| 611 UMA_HISTOGRAM_COUNTS("Chrome.BrowserCrashDumpAttempts", total_dumps); | 614 UMA_HISTOGRAM_COUNTS("Chrome.BrowserCrashDumpAttempts", total_dumps); |
| 612 } | 615 } |
| 613 #endif // defined(OS_WIN) | 616 #endif // defined(OS_WIN) |
| OLD | NEW |