Firebug的Console的用法(3)
http://www.itjxue.com 2015-08-07 22:17 来源:未知 点击次数:
7、Javascript分析器(Javascript Profiler)。
我们可以通过代码console.profile('profileName')或者单击Profiler标签来进行Javascript代码执行的分析。这个功能有点类似于console.time(),可以帮助我们评估代码的表现,但是能够提供比console.time()更详细的信息。
有三种方法可以调用Javascript profiler。一种是在代码中写入分析脚本,一种是单击profile标签,最后还可以在命令行下输入命令来执行。
执行后,可以看到详细的输出结果,下面对各项进行一些说明:
- Function Column:显示调用的函数名称;
- Call Column:显示调用次数;
- Percent Column:显示消耗的时间比;
- Own Time:显示函数内部语句执行的时间,不包括调用其他函数的时间;
- Time Column:显示函数从开始到结束的执行时间;
- Avg Column:平均时间。Avg = Own / Call;
- Min & Max Column:显示最小和最大时间;
- File Column:函数所在的文件;
8、其他的一些选项。
在Console Tab的最右侧有一个Options的选项,在这里可以自己定义需要显示的错误,其内容很好理解,这里就不多说了。有一点就是Firebug1.3以后,多了Show Chrome Errors、Show Chrome Message等几个选项,这几个选项还没有验证过其具体的作用,哪位知道的可以共享一下。
[参考资料]
- Firebug Tutorial
http://michaelsync.net/2007/09/09/firebug-tutorial-logging-profiling-and-commandline-part-i - Firebug Tutorial
http://michaelsync.net/2007/09/10/firebug-tutorial-logging-profiling-and-commandline-part-ii