如何监控浏览器中的渲染时间?
我负责一个内部公司系统,该系统具有使用 Tomcat 的 Web 前端。
- 如何监控浏览器(IE6)中特定页面的渲染时间?
- 我希望能够将结果记录在日志文件(单独的日志文件或 Tomcat 访问日志)中。
理想情况下,我需要监视访问页面的客户端上的渲染。
I work on an internal corporate system that has a web front-end using Tomcat.
- How can I monitor the rendering time of specific pages in a browser (IE6)?
- I would like to be able to record the results in a log file (separate log file or the Tomcat access log).
Ideally, I need to monitor the rendering on the clients accessing the pages.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
导航计时 API 适用于所有现代浏览器。
The Navigation Timing API is available in all modern browsers.
如果浏览器启用了 JavaScript,您可以做的一件事就是编写内联脚本并在 HTML 中首先将其发送。该脚本会做两件事:
您需要确保页面不会在代码中重写 onload,而是添加到事件处理程序列表中。
In case a browser has JavaScript enabled one of the things you could do is to write an inline script and send it first thing in your HTML. The script would do two things:
You'd need to make sure that the page doesn’t override onload later in the code, but adds to the event handlers list instead.
就非侵入性技术而言,Hammerhead 测量完整的加载时间(包括 JavaScript 执行),尽管仅限火狐浏览器。
当可以全局添加 JavaScript 代码片段来测量每个页面加载操作的开始和结束时,我已经看到了可用的结果。
As far as non-invasive techniques are concerned, Hammerhead measures complete load time (including JavaScript execution), albeit in Firefox only.
I've seen usable results when a JavaScript snippet could be added globally to measure the start and end of each page load operation.
看看Selenium - 他们提供了一个远程控制,可以自动启动不同的浏览器(例如IE6),加载页面,测试页面上的特定内容。最后生成的报告还显示渲染时间。
Have a look at Selenium - they offer a remote control that can automatically start different browsers (e.g. IE6), load pages, test for specific content on the page. At the end reports are generated that also show the rendering times.
由于其他人正在发布使用其他浏览器的答案,我想我也会的。 Chrome 有一个非常详细的分析系统,可以细分页面的渲染时间并显示每个页面所花费的时间一路走来。
至于IE,你可能要考虑编写一个插件。市场上类似的工具似乎很少。也许你可以卖掉它。
Since others are posting answers that use other browsers, I guess I will too. Chrome has a very detailed profiling system that breaks down the rendering time of the page and shows the time it took for each step along the way.
As for IE, you might want to consider writing a plugin. There seems to be few tools like this on the market. Maybe you could sell it.
在 Firefox 上,您可以使用 Firebug 来监控加载时间。使用 YSlow 插件,您甚至可以获得如何提高性能的建议。
On Firefox you can use Firebug to monitor load time. With the YSlow plugin you can even get recommendations how to improve the performance.