trace-analysis
它能做什么
这个技能向你的 AI 展示如何分析追踪文件,找出应用变慢或冻结部分的原因。适合调查界面卡顿等性能问题的工程师。
适用场景
- ✓当追踪文件显示主线程被阻塞,或界面感觉很慢时。
- ✓当需要把一个等待中的线程追溯到唤醒它的线程时。
- ✓当你需要查看一个休眠或被阻塞的线程正在等待什么时。
技能链接
https://github.com/chromium/chromium/blob/main/agents/skills/trace-analysis/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“我的应用会卡住一小会儿。能看看这个追踪文件,告诉我是哪个线程造成了延迟吗?”
每周 5 个新技能,1 分钟读完。
工作原理
AI 查看哪个线程在等待,并沿着唤醒记录找到释放它的线程。它还会检查系统调用,以了解等待中的线程被阻塞在什么上面。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Skill: Trace Analysis for Blocked Threads
When analyzing traces for UI jank or blocked threads (e.g., monitor contention on main thread):
- Don't just look at the ancestors of a slice: Looking at ancestors only shows the calling hierarchy on that thread. It might lead to dead ends or vague links if the callback was posted or triggered by another event loop.
- Follow the 'Woken By' or 'Waking' metadata: Look at the 'Running' or
'Runnable' task on the timeline to inspect what event or thread woke it up or
sent work to it. This bridges cross-thread and async gaps. In SQL queries,
utilize the
waker_utidandwaker_idcolumns in thethread_statetable to find the hard waker thread that moved the target from a sleeping to a runnable state. - Look at syscalls to understand why a thread is not runnable: If a thread
is listed as
SleepingorBlocked(and notRunnable), look at recorded syscalls (such asSYS_futex) to understand what operation or system lock it was waiting for. This adds context on what exact kernel blocker stalled the thread. - Trace cross-process flows (IPC/Binder): If a thread was woken by
system_serveror another process (like Play Store'scom.android.vending), find out what service or operation was being called or completed (e.g. searching forunbindServiceLockedoronAppUpdateInfoinsliceorargstable). Usingwaker_utidto locate the waking thread allows identifying the exact operation handle on that waker thread, creating a causal chain across processes instead of relying on luck or timing estimates. - Identify the chain of events: Chrome -> Play Core library -> System Server (handling connection or binder completion) -> Event handled by background vs UI thread. This gives context on why a shared lock was taken and held synchronously.
This approach avoids getting stuck in opaque library calls and allows tracking complete cross-process flows.
常见问题
什么是追踪文件?
追踪文件记录程序各部分随时间在做什么,有助于找到缓慢的地方。
为什么不只看父级调用?
父级调用只显示某个线程上的路径。原因可能来自另一个线程,因此技能会沿着唤醒链接追踪。
这需要特殊工具吗?
技能提到了对追踪数据运行的 SQL 查询。你的 AI 可能需要访问追踪分析工具才能运行它们。
详情
作者的原始描述
Skill for analyzing trace files and finding hard causal links across threads and processes (using waker_utid).
repo: chromium/chromium
热度
- GitHub 星标
- 25k
- 排名
- #10064
- 许可证
- BSD-3-Clause
- 更新时间
- 2026/11/2
评论
- …
同一仓库的更多技能
fuzzing
25k帮你的智能体编写模糊测试,向代码输入大量随机数据,以找出 C++ 代码中的崩溃和错误。
gn-deps-debugging
25k帮你的智能体修复 GN 构建文件中因依赖缺失或错误而导致的构建错误,且不添加范围过大、不必要的依赖。
java-memory-leaks
25k帮你的智能体通过读取 LeakCanary 的泄漏报告,查找并修复 Android 应用中的 Java 内存泄漏。
jni-type-conversion
25k帮你的智能体用更简单的 @JniType 注解,替换 Android 代码中手动的 Java 到 C++ 转换代码。