博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
console.timeLog
阅读量:2516 次
发布时间:2019-05-11

本文共 1622 字,大约阅读时间需要 5 分钟。

I work on a really complex at Mozilla but, and don't tell my colleagues, I sometimes enjoy simply using console.log and other console commands to get some simple output.  I know, I know, but hey -- whatever gets the job done.  A few years ago I detailed  for measuring time for a given set of tasks; let me show you console.timeLog, a new function in Firefox Nightly for logging events during a console.time timer!

我在Mozilla上开发了一个非常复杂的 ,但是,不告诉同事,有时我会喜欢简单地使用console.log和其他console命令来获得一些简单的输出。 我知道,但是,嘿-一切都能完成。 几年前,我详细介绍了 用于测量给定任务集的时间。 让我向您展示console.timeLog ,这是Firefox Nightly中的一项新功能,用于在console.time计时器期间记录事件!

Start by kicking off the timer with a name of your choice:

首先使用您选择的名称启动计时器:

console.time("MyApp");

Whenever you want the intermediate timer value, as well as extra information like variable or object values, you can use console.timeLog:

每当您需要中间计时器值以及诸如变量或对象值之类的额外信息时,都可以使用console.timeLog

// Same timer name, provide sublabel and optional infoconsole.timeLog("MyApp", "constructor"); // MyApp: 4ms constructorconsole.timeLog("MyApp", "render", this.state);// MyApp: 2ms render Object { disabled: false }

When your timed tasks have completed, you can call console.timeEnd to stop the timer:

定时任务完成后,可以调用console.timeEnd停止计时器:

console.timeEnd("MyApp");// MyApp: 10ms

Firefox has a Performance tab for very detailed performance metrics but, as always, the console is a great way to get some basic insight at a glance.  The timeLog function is an awesome way to get intermediate timing and information while your script runs!

Firefox的“性能”选项卡提供了非常详细的性能指标,但是与往常一样,控制台是一目了然的基本了解的好方法。 timeLog函数是一种很棒的方式,可以在脚本运行时获取中间时间和信息!

翻译自:

转载地址:http://juvwd.baihongyu.com/

你可能感兴趣的文章
(转)Linux服务器SNMP常用OID
查看>>
zoj2112 主席树动态第k大 ( 参考资料链接)
查看>>
弹出框popupWindow
查看>>
Python学习(007)-函数的特性
查看>>
扑克牌的顺子
查看>>
nodejs + express 热更新
查看>>
ClientScriptManager.RegisterClientScriptBlock Method 无效
查看>>
asp.net web site中reference的version的autoupdate
查看>>
第4章 网络层
查看>>
volatile
查看>>
项目需求分析答辩总结
查看>>
mysql-6正则表达式
查看>>
廖雪峰Java2面向对象编程-5包和classpath-1包package
查看>>
廖雪峰Java7处理日期和时间-3java.time的API-1LocalDateTime
查看>>
利用golang语法检查对象是否实现了接口
查看>>
在UBUNTU上安装基于bochs的 xv6
查看>>
Azure Storage Blob文件重命名
查看>>
RxJava2.0 使用
查看>>
FreeImage的图像处理软件
查看>>
ASP.NET MVC开发必看系列
查看>>