在 chrome://tracing 中手动加载 json
Load json manually in chrome://tracing
我有跟踪事件 JSON 数据,我想使用 chrome://tracing
查看它。但是,我不想每次都加载 JSON。
有没有一种方法可以将 JSON 数据传递给 chrome://tracing
,这样无需手动单击加载数据,我的所有数据都会加载?
Trace-viewer 工具目前以 3 种方式加载 JSON 文件:
- 当记录一个新的踪迹
- 当在选择文件后通过加载按钮加载文件时
- 当将文件拖放到 选项卡时(拖放)
所有这些都会对活动轨迹进行 one-time 更新。
技术细节
查看 profiling_view 并注意
tr.ui.b.readFile(file).then(
...
this.setActiveTrace(file.name, data);
以及从 beginRecording、onLoadClicked_ 和 dropHandler_ 调用 setActiveTrace 的一些变化。
解决建议
是的,有几种方法可以将 json 数据传递给 chrome://tracing(即跟踪查看器),而无需手动单击加载数据.
取决于你想投入多少努力:
- 不要手动点击加载而是拖放文件
- 根据监视文件更改的脚本自动拖放 (example with selenium) JSON
- 根据文件更改自动加载
- Contribute to Trace Viewer yourself and add this feature. See the tracing ecosystem explainer and contributing。请注意,它现在是 GitHub.
中 Catapult 项目的一部分
this GopherCon video 显示了我猜测的另一种解决方案,即向浏览器加载一个 HTML 页面,其中可能嵌入了 Javascript,“加载”跟踪文件。虽然我怀疑不是来自磁盘文件,而是通过自定义 http 服务器直接“提供”它。
这里有一个解决方案,如果你可以放宽必须用Chrome-Tracing打开它的要求。 Speedscope 是一个不错的替代品,可以从命令行轻松启动。
For offline use, or convenience in the terminal, you can also install speedscope via npm:
npm install -g speedscope
Invoking speedscope /path/to/profile will load speedscope in your default browser. Source
speedscope <my-chrome-tracing.json>
打开文件。
Speedscopes 提供不同的视图,但有时与 Chrome-Tracing 的视图不同。所以它可能不是所有用例的正确选择。
我有跟踪事件 JSON 数据,我想使用 chrome://tracing
查看它。但是,我不想每次都加载 JSON。
有没有一种方法可以将 JSON 数据传递给 chrome://tracing
,这样无需手动单击加载数据,我的所有数据都会加载?
Trace-viewer 工具目前以 3 种方式加载 JSON 文件:
- 当记录一个新的踪迹
- 当在选择文件后通过加载按钮加载文件时
- 当将文件拖放到 选项卡时(拖放)
所有这些都会对活动轨迹进行 one-time 更新。
技术细节
查看 profiling_view 并注意
tr.ui.b.readFile(file).then(
...
this.setActiveTrace(file.name, data);
以及从 beginRecording、onLoadClicked_ 和 dropHandler_ 调用 setActiveTrace 的一些变化。
解决建议
是的,有几种方法可以将 json 数据传递给 chrome://tracing(即跟踪查看器),而无需手动单击加载数据.
取决于你想投入多少努力:
- 不要手动点击加载而是拖放文件
- 根据监视文件更改的脚本自动拖放 (example with selenium) JSON
- 根据文件更改自动加载
- Contribute to Trace Viewer yourself and add this feature. See the tracing ecosystem explainer and contributing。请注意,它现在是 GitHub. 中 Catapult 项目的一部分
this GopherCon video 显示了我猜测的另一种解决方案,即向浏览器加载一个 HTML 页面,其中可能嵌入了 Javascript,“加载”跟踪文件。虽然我怀疑不是来自磁盘文件,而是通过自定义 http 服务器直接“提供”它。
这里有一个解决方案,如果你可以放宽必须用Chrome-Tracing打开它的要求。 Speedscope 是一个不错的替代品,可以从命令行轻松启动。
For offline use, or convenience in the terminal, you can also install speedscope via npm:
npm install -g speedscope
Invoking speedscope /path/to/profile will load speedscope in your default browser. Source
speedscope <my-chrome-tracing.json>
打开文件。
Speedscopes 提供不同的视图,但有时与 Chrome-Tracing 的视图不同。所以它可能不是所有用例的正确选择。