console.profile([label])


除非在检查器中使用,否则此方法不会显示任何内容。console.profile() 方法启动带有可选标签的 JavaScript CPU 配置文件,直到调用 console.profileEnd()。然后,该配置文件将添加到检查器的“配置文件”面板中。

¥This method does not display anything unless used in the inspector. The console.profile() method starts a JavaScript CPU profile with an optional label until console.profileEnd() is called. The profile is then added to the Profile panel of the inspector.

console.profile('MyLabel');
// Some code
console.profileEnd('MyLabel');
// Adds the profile 'MyLabel' to the Profiles panel of the inspector.