除非在检查器中使用,否则此方法不会显示任何内容。 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.

    // Some code
    // Adds the profile 'MyLabel' to the Profiles panel of the inspector.