Commit 23aed633 authored by Nicolas Pena's avatar Nicolas Pena Committed by Commit Bot

Long tasks: do not clamp times

This CL drops clamping for long tasks to improve accuracy.
Discussion at https://github.com/w3c/longtasks/issues/29

Bug: chromium:681718
Change-Id: If6df344f0203f7b6347f54ffa49be8d6689b7d71
Reviewed-on: https://chromium-review.googlesource.com/587590Reviewed-by: default avatarShubhie Panicker <panicker@chromium.org>
Reviewed-by: default avatarSteve Kobes <skobes@chromium.org>
Commit-Queue: Nicolás Peña <npm@chromium.org>
Cr-Commit-Position: refs/heads/master@{#491166}
parent fb5816a2
...@@ -19,8 +19,6 @@ ...@@ -19,8 +19,6 @@
assert_equals(longtask.entryType, "longtask"); assert_equals(longtask.entryType, "longtask");
assert_equals(longtask.name, "same-origin-self"); assert_equals(longtask.name, "same-origin-self");
assert_greater_than(longtask.duration, 50); assert_greater_than(longtask.duration, 50);
assert_equals(longtask.startTime, Math.floor(longtask.startTime),
"startTime expected to have 1 millisecond granularity");
// Assert the TaskAttributionTiming entry in attribution. // Assert the TaskAttributionTiming entry in attribution.
assert_equals(longtask.attribution.length, 1, assert_equals(longtask.attribution.length, 1,
......
...@@ -20,8 +20,6 @@ ...@@ -20,8 +20,6 @@
assert_equals(longtask.entryType, "longtask"); assert_equals(longtask.entryType, "longtask");
assert_equals(longtask.name, "same-origin-self"); assert_equals(longtask.name, "same-origin-self");
assert_greater_than(longtask.duration, 50); assert_greater_than(longtask.duration, 50);
assert_equals(longtask.startTime, Math.floor(longtask.startTime),
"startTime expected to have 1 millisecond granularity");
// Assert the TaskAttributionTiming entry in attribution. // Assert the TaskAttributionTiming entry in attribution.
assert_equals(longtask.attribution.length, 1, assert_equals(longtask.attribution.length, 1,
......
...@@ -13,8 +13,6 @@ async_test(function (t) { ...@@ -13,8 +13,6 @@ async_test(function (t) {
assert_equals(longtask.entryType, "longtask"); assert_equals(longtask.entryType, "longtask");
assert_equals(longtask.name, "self"); assert_equals(longtask.name, "self");
assert_greater_than(longtask.duration, 50); assert_greater_than(longtask.duration, 50);
assert_equals(longtask.startTime, Math.floor(longtask.startTime),
"startTime expected to have 1 miillisecond granularity");
// Assert the TaskAttributionTiming entry in attribution. // Assert the TaskAttributionTiming entry in attribution.
assert_equals(longtask.attribution.length, 1, assert_equals(longtask.attribution.length, 1,
......
...@@ -14,8 +14,6 @@ async_test(function (t) { ...@@ -14,8 +14,6 @@ async_test(function (t) {
assert_equals(longtask.entryType, "longtask"); assert_equals(longtask.entryType, "longtask");
assert_equals(longtask.name, "self"); assert_equals(longtask.name, "self");
assert_greater_than(longtask.duration, 50); assert_greater_than(longtask.duration, 50);
assert_equals(longtask.startTime, Math.floor(longtask.startTime),
"startTime expected to have 1 miillisecond granularity");
// Assert the TaskAttributionTiming entry in attribution. // Assert the TaskAttributionTiming entry in attribution.
assert_equals(longtask.attribution.length, 1, assert_equals(longtask.attribution.length, 1,
......
...@@ -14,8 +14,6 @@ async_test(function (t) { ...@@ -14,8 +14,6 @@ async_test(function (t) {
assert_equals(longtask.entryType, "longtask"); assert_equals(longtask.entryType, "longtask");
assert_equals(longtask.name, "self"); assert_equals(longtask.name, "self");
assert_greater_than(longtask.duration, 50); assert_greater_than(longtask.duration, 50);
assert_equals(longtask.startTime, Math.floor(longtask.startTime),
"startTime expected to have 1 miillisecond granularity");
// Assert the TaskAttributionTiming entry in attribution. // Assert the TaskAttributionTiming entry in attribution.
assert_equals(longtask.attribution.length, 1, assert_equals(longtask.attribution.length, 1,
......
...@@ -9,15 +9,6 @@ ...@@ -9,15 +9,6 @@
namespace blink { namespace blink {
namespace {
double ClampToMillisecond(double time_in_millis) {
// Long task times are clamped to 1 millisecond for security.
return floor(time_in_millis);
}
} // namespace
// static // static
PerformanceLongTaskTiming* PerformanceLongTaskTiming::Create( PerformanceLongTaskTiming* PerformanceLongTaskTiming::Create(
double start_time, double start_time,
...@@ -36,10 +27,7 @@ PerformanceLongTaskTiming::PerformanceLongTaskTiming(double start_time, ...@@ -36,10 +27,7 @@ PerformanceLongTaskTiming::PerformanceLongTaskTiming(double start_time,
String culprit_frame_src, String culprit_frame_src,
String culprit_frame_id, String culprit_frame_id,
String culprit_frame_name) String culprit_frame_name)
: PerformanceEntry(name, : PerformanceEntry(name, "longtask", start_time, end_time) {
"longtask",
ClampToMillisecond(start_time),
ClampToMillisecond(end_time)) {
// Only one possible task type exists currently: "script" // Only one possible task type exists currently: "script"
// Only one possible container type exists currently: "iframe" // Only one possible container type exists currently: "iframe"
TaskAttributionTiming* attribution_entry = TaskAttributionTiming* attribution_entry =
......
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