我需要在 Web 开发编码会话期间收集有关 firefox CPU 使用情况的数据,我想知道是否可以监控特定 firefox 插件的 CPU 使用情况。
现在我正在使用 Windows 的 perfmon.msc,但它只允许我监控整个 firefox 进程。
你知道有什么工具可以让我从插件中获取 CPU 数据吗?有可能吗?
您可以使用Process Explorer分析 CPU 使用率。右键单击 Firefox 进程并选择属性。在“线程”选项卡上,您将看到不同的线程,包括 Flash 或 Acrobat 等插件,并列出了它们的 CPU 使用率。
编辑:事实上,也应该可以使用 perfmon 监视线程:右键单击以选择Add Counters...,然后选择Threads作为性能对象。
我猜你最好的选择是在单独的 Firefox 进程中测试你的插件,但无论如何你可能正在这样做。
对于真正的分析,你应该使用 Firebug。我不确定,但我认为可以在 Firefox 中运行 XUL 应用程序(无需将其集成为插件)。如果这不是一个选项,那么您可以将您怀疑速度较慢的代码分离到网页中并使用Firebug对其进行分析。这当然只适用于不与 Mozilla 核心交互的东西。
Actually Firefox does have a built-in "Task-Manager" for a few years now. Just type about:performance in the URL. It shows Name, Type, Energy Impact and Memory of each tab and add-on.
If you want to dig deeper Shift + F5 opens the performance tool where you can record e. g. opening a website and look into timings etc.
有一些 JS 分析器也可以分析扩展 JS,但是它们并不能真正帮助找到有问题的插件。
Firefox 4 的概念设计中有一个功能,但由于 FX4 的功能现在被冻结,它被抛弃了。但我仍然在追求这个功能,并希望在这个方向上取得任何进展。
这是一个问题,可以找到更多相关信息; https://superuser.com/q/218733/46962
对于 CPU 利用率,您可以使用 MS Perfmon 收集数据,它是 Windows 的一部分,也用于类似目的,例如在 SQL 服务器上收集 CPU 性能和统计数据以进行优化。
Now in Firefox 94 there are such tools:
about:performance
can show you CPU (Energy Impact) and Memory usage for all tabs and addons.
about:memory
will allow you to make recordings of processes' resource usage statistics, then you can filter it knowing CPU-hungry process id, which you get from htop
or top
command. In the recorded snapshot you'll see extensions and their unique ids and can use it to identify and remove the extension.