OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "components/startup_metric_utils/startup_metric_utils.h" | 5 #include "components/startup_metric_utils/startup_metric_utils.h" |
6 | 6 |
7 #include "base/containers/hash_tables.h" | 7 #include "base/containers/hash_tables.h" |
8 #include "base/environment.h" | 8 #include "base/environment.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 kStartupTimeMin, | 222 kStartupTimeMin, |
223 kStartupTimeMax, | 223 kStartupTimeMax, |
224 kStartupTimeBuckets, | 224 kStartupTimeBuckets, |
225 base::Histogram::kUmaTargetedHistogramFlag); | 225 base::Histogram::kUmaTargetedHistogramFlag); |
226 counter->AddTime(i->second); | 226 counter->AddTime(i->second); |
227 } | 227 } |
228 | 228 |
229 g_startup_stats_collection_finished = true; | 229 g_startup_stats_collection_finished = true; |
230 } | 230 } |
231 | 231 |
| 232 const base::Time* MainEntryPointTime() { |
| 233 if (!g_main_entry_time_was_recorded) |
| 234 return NULL; |
| 235 return MainEntryPointTimeInternal(); |
| 236 } |
| 237 |
232 ScopedSlowStartupUMA::~ScopedSlowStartupUMA() { | 238 ScopedSlowStartupUMA::~ScopedSlowStartupUMA() { |
233 if (g_startup_stats_collection_finished) | 239 if (g_startup_stats_collection_finished) |
234 return; | 240 return; |
235 | 241 |
236 base::AutoLock locker(*GetSubsystemStartupTimeHashLock()); | 242 base::AutoLock locker(*GetSubsystemStartupTimeHashLock()); |
237 SubsystemStartupTimeHash* hash = GetSubsystemStartupTimeHash(); | 243 SubsystemStartupTimeHash* hash = GetSubsystemStartupTimeHash(); |
238 // Only record the initial sample for a given histogram. | 244 // Only record the initial sample for a given histogram. |
239 if (hash->find(histogram_name_) != hash->end()) | 245 if (hash->find(histogram_name_) != hash->end()) |
240 return; | 246 return; |
241 | 247 |
242 (*hash)[histogram_name_] = | 248 (*hash)[histogram_name_] = |
243 base::TimeTicks::Now() - start_time_; | 249 base::TimeTicks::Now() - start_time_; |
244 } | 250 } |
245 | 251 |
246 } // namespace startup_metric_utils | 252 } // namespace startup_metric_utils |
OLD | NEW |