Profiler: stop() method

Limited availability

This feature is not Baseline because it does not work in some of the most widely-used browsers.

Experimental: This is an experimental technology
Check the Browser compatibility table carefully before using this in production.

Phương thức stop() của giao diện Profiler dừng profiler và trả về một Promise phân giải thành dữ liệu profile.

Cú pháp

js
stop()

Tham số

Không có.

Giá trị trả về

Một Promise phân giải thành đối tượng chứa dữ liệu profile. Định dạng và cách giải thích đối tượng này được mô tả trong Cấu trúc và định dạng Profile.

Ví dụ

Ghi lại một profile

Code sau đây tạo profile cho thao tác doWork() và ghi log kết quả.

js
const profiler = new Profiler({ sampleInterval: 10, maxBufferSize: 10000 });

doWork();

const profile = await profiler.stop();
console.log(JSON.stringify(profile));

Thông số kỹ thuật

Specification
JS Self-Profiling API
# dom-profiler-stop

Tương thích trình duyệt