0.0.3 • Published 3 years ago

@cniot/profiler v0.0.3

Weekly downloads
-
License
-
Repository
-
Last release
3 years ago

用于记录程序的运行性能。

example

profiler.startTracing("SETTIMEOUT");
profiler.startTracing("DEFAULT");
setTimeout(() => {
  profiler.stopTracing();
  profiler.print();
  // SETTIMEOUT       1601359696951   1601359699953   3002
  // DEFAULT          1601359696951   1601359696952   1
}, 3000);
profiler.stopTracing();

API

  • startTracing(String)

记录开始时间,任意填写一个字符串标记符

  • stopTracing()

结束记录。startTracing,stopTracing 必须成对出现

  • exports()

导出数据

  • print()

使用 console.log 在控制台打印数据

  • clear()

清理统计数据