Commit 8cc4ec76 authored by azarchs's avatar azarchs Committed by Commit bot

Avoid using ToInternalValue in computing timings, so that the timings are...

Avoid using ToInternalValue in computing timings, so that the timings are consistent accross platforms and with javascript performance timings API.

BUG=413672

Review URL: https://codereview.chromium.org/557953006

Cr-Commit-Position: refs/heads/master@{#295123}
parent b88bd7ef
...@@ -47,8 +47,7 @@ void RecordMainEntryTimeHistogram() { ...@@ -47,8 +47,7 @@ void RecordMainEntryTimeHistogram() {
const int kLowWordMask = 0xFFFFFFFF; const int kLowWordMask = 0xFFFFFFFF;
const int kLower31BitsMask = 0x7FFFFFFF; const int kLower31BitsMask = 0x7FFFFFFF;
base::TimeDelta browser_main_entry_time_absolute = base::TimeDelta browser_main_entry_time_absolute =
base::TimeDelta::FromMilliseconds( *MainEntryPointTimeInternal() - base::Time::UnixEpoch();
MainEntryPointTimeInternal()->ToInternalValue() / 1000.0);
uint64 browser_main_entry_time_raw_ms = uint64 browser_main_entry_time_raw_ms =
browser_main_entry_time_absolute.InMilliseconds(); browser_main_entry_time_absolute.InMilliseconds();
......
...@@ -47,7 +47,7 @@ bool CurrentRenderViewImpl(RenderViewImpl** out) { ...@@ -47,7 +47,7 @@ bool CurrentRenderViewImpl(RenderViewImpl** out) {
// Example return value: // Example return value:
// {'load_start_ms': 1, 'load_duration_ms': 2.5} // {'load_start_ms': 1, 'load_duration_ms': 2.5}
// either value may be null if a web contents hasn't fully loaded. // either value may be null if a web contents hasn't fully loaded.
// load_start_ms is represented as milliseconds since system boot. // load_start_ms is represented as milliseconds since the unix epoch.
void ConvertLoadTimeToJSON( void ConvertLoadTimeToJSON(
const base::Time& load_start_time, const base::Time& load_start_time,
const base::Time& load_stop_time, const base::Time& load_stop_time,
...@@ -57,7 +57,8 @@ void ConvertLoadTimeToJSON( ...@@ -57,7 +57,8 @@ void ConvertLoadTimeToJSON(
if (load_start_time.is_null()) { if (load_start_time.is_null()) {
item.Set("load_start_ms", base::Value::CreateNullValue()); item.Set("load_start_ms", base::Value::CreateNullValue());
} else { } else {
item.SetDouble("load_start_ms", load_start_time.ToInternalValue() / 1000); item.SetDouble("load_start_ms", (load_start_time - base::Time::UnixEpoch())
.InMillisecondsF());
} }
if (load_start_time.is_null() || load_stop_time.is_null()) { if (load_start_time.is_null() || load_stop_time.is_null()) {
item.Set("load_duration_ms", base::Value::CreateNullValue()); item.Set("load_duration_ms", base::Value::CreateNullValue());
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment