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

Unified Diff: chrome/browser/performance_monitor/process_metrics_history.cc

Issue 29873002: PerformanceMonitor: Add a new UMA histograms to track average CPU utilization (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 7 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/performance_monitor/process_metrics_history.cc
diff --git a/chrome/browser/performance_monitor/process_metrics_history.cc b/chrome/browser/performance_monitor/process_metrics_history.cc
index 9ac206fb36151817a4ccbe446fb28fab2d91d2f6..38c1e417fa4cb66b52e1f9850d022d3b1606aac3 100644
--- a/chrome/browser/performance_monitor/process_metrics_history.cc
+++ b/chrome/browser/performance_monitor/process_metrics_history.cc
@@ -52,7 +52,7 @@ void ProcessMetricsHistory::Initialize(base::ProcessHandle process_handle,
}
void ProcessMetricsHistory::SampleMetrics() {
- double cpu_usage = process_metrics_->GetCPUUsage();
+ double cpu_usage = process_metrics_->GetPlatformIndependentCPUUsage();
min_cpu_usage_ = std::min(min_cpu_usage_, cpu_usage);
accumulated_cpu_usage_ += cpu_usage;
@@ -74,9 +74,15 @@ void ProcessMetricsHistory::EndOfCycle() {
void ProcessMetricsHistory::RunPerformanceTriggers() {
// As an initial step, we only care about browser processes.
- if (process_type_ != content::PROCESS_TYPE_BROWSER)
+ if (process_type_ != content::PROCESS_TYPE_BROWSER || sample_count_ == 0)
return;
+ // We scale up to the equivalent of 64 CPU cores fully loaded. More than this
+ // doesn't really matter, as we're already in a terrible place.
+ UMA_HISTOGRAM_CUSTOM_COUNTS("PerformanceMonitor.AverageCPU.BrowserProcess",
jar (doing other things) 2013/10/22 22:30:03 This may be interesting to look at.... but it is h
oystein (OOO til 10th of July) 2013/10/24 14:47:56 Definitely some good points, and to be honest I'm
+ accumulated_cpu_usage_ / sample_count_,
+ 0, 6400, 50);
+
// If CPU usage has consistently been above our threshold,
// we *may* have an issue.
if (min_cpu_usage_ > kHighCPUUtilizationThreshold)

Powered by Google App Engine
This is Rietveld 408576698