跳到正文
Skillpedia
通用编程25k · #10064

trace-analysis

它能做什么

这个技能向你的 AI 展示如何分析追踪文件,找出应用变慢或冻结部分的原因。适合调查界面卡顿等性能问题的工程师。

适用场景

  • ✓当追踪文件显示主线程被阻塞,或界面感觉很慢时。
  • ✓当需要把一个等待中的线程追溯到唤醒它的线程时。
  • ✓当你需要查看一个休眠或被阻塞的线程正在等待什么时。

技能链接

https://github.com/chromium/chromium/blob/main/agents/skills/trace-analysis/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/chromium/chromium/blob/main/agents/skills/trace-analysis/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 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):

  1. 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.
  2. 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_utid and waker_id columns in the thread_state table to find the hard waker thread that moved the target from a sleeping to a runnable state.
  3. Look at syscalls to understand why a thread is not runnable: If a thread is listed as Sleeping or Blocked (and not Runnable), look at recorded syscalls (such as SYS_futex) to understand what operation or system lock it was waiting for. This adds context on what exact kernel blocker stalled the thread.
  4. Trace cross-process flows (IPC/Binder): If a thread was woken by system_server or another process (like Play Store's com.android.vending), find out what service or operation was being called or completed (e.g. searching for unbindServiceLocked or onAppUpdateInfo in slice or args table). Using waker_utid to 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.
  5. 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

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能