google-chrome - Chrome 开发工具跟踪文件的完整事件中“dur”的总和
问题描述
我有来自 chrome 开发工具的跟踪文件,用于我的 Web 应用程序的特定工作流程。我试图弄清楚工作流程所花费的总时间。
我正在使用 Puppeteer 脚本和它的跟踪功能来执行此操作。我通读了跟踪文件 JSON,按阶段类型过滤 - 'X' 是完整事件。过滤后,我总结了所有“dur”字段,我相信这应该给我工作流程的总时间。
结果却大相径庭。总持续时间太大了,甚至无法考虑远程接近我在屏幕上可以看到的内容。
假设这个时间是毫秒微秒(在 JSON 的任何地方都没有提到它,除了在本文末尾链接的文档中)。
我还需要过滤任何其他字段吗?(可能重复?)
// filter out only complete events
const allCompleteEvents = parsedJSON.filter(e => e.ph === 'X')
.map(completeEvent => {
const {pid, tid, dur, name} = completeEvent;
return { pid, tid, dur, name}
});
// sum of durations...this number is way too big to be correct!
const completeEventsDuration = completeEvents.reduce((total, curr) => total + curr.dur, 0);
参考:https ://docs.google.com/document/d/1CvAClvFfyA5R-PhYUmn5OOQtYMH4h6I0nSsKchNAySU/preview#
解决方案
推荐阅读
- php - 带有可选项目的多个文件上传
- python - 在 python 列表中提取带有特定单词的推文。情绪分析
- python - Python - 尝试将用户输入转换为字符串并阻止用户输入非十进制数字时出现问题
- c++ - 为什么默认 noexcept 移动构造函数被接受?
- delphi - Delphi IPWorks XMPP - 搜索用户
- javascript - Redux 在重新加载时失去了 firebase 用户
- python - 在 cx_Oracle 中循环追加大型数据集的 SQL 字典
- django - 如何使用 docker 在 Django 中执行代码导航
- ios - 将 UIView 中输入的数据传递给 Widget
- c++ - C ++客户端套接字仅接收消息的第一个字母