c4772b58aa
Add simple implementations of performance.mark/performance.measure -- these aren't fully to spec, and in particular don't have the right base class or prototype, but they're similar enough for simple use. Additionally, log trace events for performance.measure, similar to Chromium -- this allows us to annotate traces collected with d8's --enable-tracing. Change-Id: Ib4d7104ba94a261493c57334b2008956e4d89dd1 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3918092 Reviewed-by: Camillo Bruni <cbruni@chromium.org> Commit-Queue: Leszek Swirski <leszeks@chromium.org> Auto-Submit: Leszek Swirski <leszeks@chromium.org> Cr-Commit-Position: refs/heads/main@{#83478}
24 lines
948 B
JavaScript
24 lines
948 B
JavaScript
// Copyright 2022 the V8 project authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
// found in the LICENSE file.
|
|
|
|
const mark = performance.mark("a mark");
|
|
assertEquals("mark", mark.entryType);
|
|
assertEquals("a mark", mark.name);
|
|
assertTrue(typeof mark.startTime == "number");
|
|
assertEquals(0, mark.duration);
|
|
|
|
const measure = performance.measure("a measure")
|
|
assertEquals("measure", measure.entryType);
|
|
assertEquals("a measure", measure.name);
|
|
assertEquals(0, measure.startTime);
|
|
assertTrue(typeof mark.duration == "number");
|
|
assertTrue(mark.startTime <= measure.duration);
|
|
|
|
const range_measure = performance.measure("a range measure", mark)
|
|
assertEquals("measure", range_measure.entryType);
|
|
assertEquals("a range measure", range_measure.name);
|
|
assertEquals(mark.startTime, range_measure.startTime);
|
|
assertTrue(typeof range_measure.duration == "number");
|
|
assertTrue(0 <= range_measure.duration);
|