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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 | 55 |
56 base::TimeDelta browser_main_entry_time_raw_ms_high_word = | 56 base::TimeDelta browser_main_entry_time_raw_ms_high_word = |
57 base::TimeDelta::FromMilliseconds( | 57 base::TimeDelta::FromMilliseconds( |
58 (browser_main_entry_time_raw_ms >> 32) & kLowWordMask); | 58 (browser_main_entry_time_raw_ms >> 32) & kLowWordMask); |
59 // Shift by one because histograms only support non-negative values. | 59 // Shift by one because histograms only support non-negative values. |
60 base::TimeDelta browser_main_entry_time_raw_ms_low_word = | 60 base::TimeDelta browser_main_entry_time_raw_ms_low_word = |
61 base::TimeDelta::FromMilliseconds( | 61 base::TimeDelta::FromMilliseconds( |
62 (browser_main_entry_time_raw_ms >> 1) & kLower31BitsMask); | 62 (browser_main_entry_time_raw_ms >> 1) & kLower31BitsMask); |
63 | 63 |
64 // A timestamp is a 64 bit value, yet histograms can only store 32 bits. | 64 // A timestamp is a 64 bit value, yet histograms can only store 32 bits. |
65 HISTOGRAM_TIMES("Startup.BrowserMainEntryTimeAbsoluteHighWord", | 65 LOCAL_HISTOGRAM_TIMES("Startup.BrowserMainEntryTimeAbsoluteHighWord", |
66 browser_main_entry_time_raw_ms_high_word); | 66 browser_main_entry_time_raw_ms_high_word); |
67 HISTOGRAM_TIMES("Startup.BrowserMainEntryTimeAbsoluteLowWord", | 67 LOCAL_HISTOGRAM_TIMES("Startup.BrowserMainEntryTimeAbsoluteLowWord", |
68 browser_main_entry_time_raw_ms_low_word); | 68 browser_main_entry_time_raw_ms_low_word); |
69 } | 69 } |
70 | 70 |
71 bool g_main_entry_time_was_recorded = false; | 71 bool g_main_entry_time_was_recorded = false; |
72 bool g_startup_stats_collection_finished = false; | 72 bool g_startup_stats_collection_finished = false; |
73 bool g_was_slow_startup = false; | 73 bool g_was_slow_startup = false; |
74 | 74 |
75 // Environment variable that stores the timestamp when the executable's main() | 75 // Environment variable that stores the timestamp when the executable's main() |
76 // function was entered. | 76 // function was entered. |
77 const char kChromeMainTimeEnvVar[] = "CHROME_MAIN_TIME"; | 77 const char kChromeMainTimeEnvVar[] = "CHROME_MAIN_TIME"; |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
243 SubsystemStartupTimeHash* hash = GetSubsystemStartupTimeHash(); | 243 SubsystemStartupTimeHash* hash = GetSubsystemStartupTimeHash(); |
244 // Only record the initial sample for a given histogram. | 244 // Only record the initial sample for a given histogram. |
245 if (hash->find(histogram_name_) != hash->end()) | 245 if (hash->find(histogram_name_) != hash->end()) |
246 return; | 246 return; |
247 | 247 |
248 (*hash)[histogram_name_] = | 248 (*hash)[histogram_name_] = |
249 base::TimeTicks::Now() - start_time_; | 249 base::TimeTicks::Now() - start_time_; |
250 } | 250 } |
251 | 251 |
252 } // namespace startup_metric_utils | 252 } // namespace startup_metric_utils |
OLD | NEW |