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 29 matching lines...) Expand all Loading... |
40 return slow_startup_time_hash_lock; | 40 return slow_startup_time_hash_lock; |
41 } | 41 } |
42 | 42 |
43 // Record time of main entry so it can be read from Telemetry performance | 43 // Record time of main entry so it can be read from Telemetry performance |
44 // tests. | 44 // tests. |
45 // TODO(jeremy): Remove once crbug.com/317481 is fixed. | 45 // TODO(jeremy): Remove once crbug.com/317481 is fixed. |
46 void RecordMainEntryTimeHistogram() { | 46 void RecordMainEntryTimeHistogram() { |
47 const int kLowWordMask = 0xFFFFFFFF; | 47 const int kLowWordMask = 0xFFFFFFFF; |
48 const int kLower31BitsMask = 0x7FFFFFFF; | 48 const int kLower31BitsMask = 0x7FFFFFFF; |
49 base::TimeDelta browser_main_entry_time_absolute = | 49 base::TimeDelta browser_main_entry_time_absolute = |
50 base::TimeDelta::FromMilliseconds( | 50 *MainEntryPointTimeInternal() - base::Time::UnixEpoch(); |
51 MainEntryPointTimeInternal()->ToInternalValue() / 1000.0); | |
52 | 51 |
53 uint64 browser_main_entry_time_raw_ms = | 52 uint64 browser_main_entry_time_raw_ms = |
54 browser_main_entry_time_absolute.InMilliseconds(); | 53 browser_main_entry_time_absolute.InMilliseconds(); |
55 | 54 |
56 base::TimeDelta browser_main_entry_time_raw_ms_high_word = | 55 base::TimeDelta browser_main_entry_time_raw_ms_high_word = |
57 base::TimeDelta::FromMilliseconds( | 56 base::TimeDelta::FromMilliseconds( |
58 (browser_main_entry_time_raw_ms >> 32) & kLowWordMask); | 57 (browser_main_entry_time_raw_ms >> 32) & kLowWordMask); |
59 // Shift by one because histograms only support non-negative values. | 58 // Shift by one because histograms only support non-negative values. |
60 base::TimeDelta browser_main_entry_time_raw_ms_low_word = | 59 base::TimeDelta browser_main_entry_time_raw_ms_low_word = |
61 base::TimeDelta::FromMilliseconds( | 60 base::TimeDelta::FromMilliseconds( |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
243 SubsystemStartupTimeHash* hash = GetSubsystemStartupTimeHash(); | 242 SubsystemStartupTimeHash* hash = GetSubsystemStartupTimeHash(); |
244 // Only record the initial sample for a given histogram. | 243 // Only record the initial sample for a given histogram. |
245 if (hash->find(histogram_name_) != hash->end()) | 244 if (hash->find(histogram_name_) != hash->end()) |
246 return; | 245 return; |
247 | 246 |
248 (*hash)[histogram_name_] = | 247 (*hash)[histogram_name_] = |
249 base::TimeTicks::Now() - start_time_; | 248 base::TimeTicks::Now() - start_time_; |
250 } | 249 } |
251 | 250 |
252 } // namespace startup_metric_utils | 251 } // namespace startup_metric_utils |
OLD | NEW |