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

Side by Side Diff: chrome/common/startup_metric_utils.cc

Issue 12207058: Connect SparseHistogram with the rest of stats system (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 7 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « chrome/common/metrics/metrics_service_base.cc ('k') | chrome/test/base/uma_histogram_helper.cc » ('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 "chrome/common/startup_metric_utils.h" 5 #include "chrome/common/startup_metric_utils.h"
6 6
7 #include "base/hash_tables.h" 7 #include "base/hash_tables.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/metrics/histogram.h" 9 #include "base/metrics/histogram.h"
10 #include "base/metrics/histogram_base.h" 10 #include "base/metrics/histogram_base.h"
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 return; 106 return;
107 DCHECK(!g_startup_stats_collection_finished); 107 DCHECK(!g_startup_stats_collection_finished);
108 108
109 const base::TimeDelta kStartupTimeMin( 109 const base::TimeDelta kStartupTimeMin(
110 base::TimeDelta::FromMilliseconds(1)); 110 base::TimeDelta::FromMilliseconds(1));
111 const base::TimeDelta kStartupTimeMax(base::TimeDelta::FromMinutes(5)); 111 const base::TimeDelta kStartupTimeMax(base::TimeDelta::FromMinutes(5));
112 static const size_t kStartupTimeBuckets = 100; 112 static const size_t kStartupTimeBuckets = 100;
113 113
114 // Set UMA flag for histograms outside chrome/ that can't use the 114 // Set UMA flag for histograms outside chrome/ that can't use the
115 // ScopedSlowStartupUMA class. 115 // ScopedSlowStartupUMA class.
116 base::Histogram* histogram = 116 base::HistogramBase* histogram =
117 base::StatisticsRecorder::FindHistogram("Startup.SlowStartupNSSInit"); 117 base::StatisticsRecorder::FindHistogram("Startup.SlowStartupNSSInit");
118 if (histogram) 118 if (histogram)
119 histogram->SetFlags(base::HistogramBase::kUmaTargetedHistogramFlag); 119 histogram->SetFlags(base::HistogramBase::kUmaTargetedHistogramFlag);
120 120
121 // Iterate over the stats recorded by ScopedSlowStartupUMA and create 121 // Iterate over the stats recorded by ScopedSlowStartupUMA and create
122 // histograms for them. 122 // histograms for them.
123 base::AutoLock locker(*GetSubsystemStartupTimeHashLock()); 123 base::AutoLock locker(*GetSubsystemStartupTimeHashLock());
124 SubsystemStartupTimeHash* time_hash = GetSubsystemStartupTimeHash(); 124 SubsystemStartupTimeHash* time_hash = GetSubsystemStartupTimeHash();
125 for (SubsystemStartupTimeHash::iterator i = time_hash->begin(); 125 for (SubsystemStartupTimeHash::iterator i = time_hash->begin();
126 i != time_hash->end(); 126 i != time_hash->end();
(...skipping 19 matching lines...) Expand all
146 SubsystemStartupTimeHash* hash = GetSubsystemStartupTimeHash(); 146 SubsystemStartupTimeHash* hash = GetSubsystemStartupTimeHash();
147 // Only record the initial sample for a given histogram. 147 // Only record the initial sample for a given histogram.
148 if (hash->find(histogram_name_) != hash->end()) 148 if (hash->find(histogram_name_) != hash->end())
149 return; 149 return;
150 150
151 (*hash)[histogram_name_] = 151 (*hash)[histogram_name_] =
152 base::TimeTicks::Now() - start_time_; 152 base::TimeTicks::Now() - start_time_;
153 } 153 }
154 154
155 } // namespace startup_metric_utils 155 } // namespace startup_metric_utils
OLDNEW
« no previous file with comments | « chrome/common/metrics/metrics_service_base.cc ('k') | chrome/test/base/uma_histogram_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698