最近参加比赛,前置知识需了解并使用一下 Google 的开源 tracing 工具 Perfetto,主要想用于跟踪 Linux 行为。
安装 Perfetto
跟着官方文档 https://perfetto.dev/docs/quickstart/linux-tracing 一步步做。
1
首先在第一步 git clone
时就遇到了问题,总是连接超时:
通过一些更改代理的手段无法解决,最后还是用了清华的镜像,用 https://mirrors.tuna.tsinghua.edu.cn/git/AOSP/ 替换 https://android.googlesource.com/ 即可,也就是在命令行输入:
git clone https://mirrors.tuna.tsinghua.edu.cn/git/AOSP/platform/external/perfetto/ && cd perfetto
就可以安装成功:
2
在第二步下载额外依赖库时依然有同样的问题,这一步是运行 tools/install-build-deps
脚本来下载并提取构建 Perfeto 所需的依赖项,直接运行则会出现:
黄色的 hint 是提醒我们要设置默认分支为 master,所以用这行命令就可以解决:
git config --global init.defaultBranch master
看报错提示可以发现又是因为连接到 https://android.googlesource.com/platform/external/googletest.git/ 时超时,于是我们根据 ~/perfetto/tools
路径找到 tools/install-build-deps
脚本文件,并搜索 android.googlesource
可以找到这个依赖库:
按 1 中所说,替换网址并保存
(待更新)