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

Side by Side Diff: components/startup_metric_utils/startup_metric_utils.cc

Issue 557953006: Avoid using ToInternalValue in computing timings, so that the timings are consistent accross platfo… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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
« no previous file with comments | « no previous file | content/renderer/stats_collection_controller.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 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
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
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
OLDNEW
« no previous file with comments | « no previous file | content/renderer/stats_collection_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698