mirror of
https://github.com/servo/servo.git
synced 2025-10-12 22:40:19 +01:00
Update web-platform-tests to revision b'468d01bbd84da2babf265c6af46947be68713440'
This commit is contained in:
parent
35e95f55a1
commit
58e8ee674b
9438 changed files with 266112 additions and 106976 deletions
|
@ -0,0 +1,26 @@
|
|||
(function(global) {
|
||||
let counter = 0;
|
||||
|
||||
// Spins up a new profiler and performs some work in a new top-level task,
|
||||
// calling some builtins. Returns a promise for the resulting trace.
|
||||
const profileBuiltinsInNewTask = () => {
|
||||
// Run profiling logic in a new task to eliminate the caller stack.
|
||||
return new Promise(resolve => {
|
||||
setTimeout(async () => {
|
||||
const profiler = new Profiler({ sampleInterval: 10, maxBufferSize: 10000 });
|
||||
for (const deadline = performance.now() + 500; performance.now() < deadline;) {
|
||||
// Run a range of builtins to ensure they get included in the trace.
|
||||
// Store this computation in a variable to prevent getting optimized out.
|
||||
counter += Math.random();
|
||||
counter += performance.now();
|
||||
}
|
||||
const trace = await profiler.stop();
|
||||
resolve(trace);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
global.ProfilingScript = {
|
||||
profileBuiltinsInNewTask,
|
||||
}
|
||||
})(window);
|
Loading…
Add table
Add a link
Reference in a new issue