# 向 Brendan Gregg 致敬：Rewind 性能分析新招式

Original title: Worshipping at the Altar of Brendan Gregg

> Hacker News story 50626413 · language: zh · submitted 2026-11-24
> Web version: https://zeli.app/zh/story/50626413
> About this feed: https://zeli.app/llms.txt · Agent guide: https://zeli.app/skill.md

▲ 211 · by [kqr](<https://news.ycombinator.com/user?id=kqr>) · 💬 39
[original](<https://fzakaria.com/2026/11/12/worshipping-at-the-altar-of-brendan-gregg>) · [HN discussion](<https://news.ycombinator.com/item?id=50626413>)

## Summary

我承认自己对 AI 有些狂热，但 Rewind 这个确定性虚拟机让我发现了性能分析的新大陆。受 Brendan Gregg 的启发，我新增了 rewind time 命令，它能精准定位构建和测试中的关键路径。传统 CPU 分析往往忽略线程休眠时间，而 Rewind 能记录每一次上下文切换和唤醒，揭示那些隐藏在睡眠中的性能瓶颈。通过可视化关键路径，我们不仅能看到时间花在哪里，还能直接跳转到源码行或启动 gdb 进行调试。这不仅是向 Brendan Gregg 的致敬，更是将性能分析从玄学变为科学的又一次尝试。

## Key quote

> 如果你崇拜 Brendan Gregg，你就知道他把性能分析从一门黑暗的艺术变成了一门科学。

## HN discussion (39 comments)

### [aidanhs](<https://news.ycombinator.com/item?id=50628206>)

> 我非常喜欢确定性虚拟机（deterministic VM）这个概念（出于类似原因，我也很喜欢 Antithesis！），不过在另一个帖子里我看到你们的虚拟机是单线程的，我觉得这肯定会牺牲掉很多性能分析场景？例如，当你处理高吞吐量的多线程流水线时。
>
> 就我个人而言，对于用火焰图（flamegraphs）做多线程性能分析，我的热情已经冷却了——想要推断跨线程的依赖关系实在太难了。我建议对性能分析感兴趣的人去读读 https://thume.ca/2023/12/02/tracing-methods/（如果有 2023 年底之后更新的工具普查文章，我也很想听听），这篇文章为 perfetto 做了个相当不错的论证。不过在我自己的使用场景中，我最终还是自己写了个低延迟的、针对特定语言的追踪输出库，可以聚合后加载到 jaeger-ui 里，因为这样你实际上可以添加元数据来指示你要追踪的 span 是从哪里来的等等。
>
> 给作者：你们的产品看起来非常酷，但我鼓励你（或者你雇的人！）做一次彻底的校对，去掉那些 LLM 味儿。把像 "process, with what it started" 这样的文字当作 ps 类输出的列标题，简直就像指甲刮黑板一样让人难受。

### [disperso](<https://news.ycombinator.com/item?id=50631074>)

> 看起来非常有意思。在功能、局限性等方面，这和 RR（record and replay）有什么可比之处吗？
>
> https://github.com/rr-debugger/rr

### [uvdn7](<https://news.ycombinator.com/item?id=50629263>)

> 这种类型的分析和确定性虚拟机能帮助到异步工作负载吗（例如 C++ coroutine、fiber、future 等）？我的理解是它们帮不了。我很想知道如何找到异步代码的关键路径。感觉如果不修改框架代码（例如嵌入某种请求上下文，以便我们知道线程 A 上的后续任务实际上是请求 R 的延续），要做到这一点非常困难（甚至可能是不可能的）。

### [adsharma](<https://news.ycombinator.com/item?id=50630802>)

> 这类事情可以通过 sleep profiling 或 CPU stall profiling 来实现。
>
> 但这需要在 Linux 内核中做出权衡，或者在 CPU 设计中投入更多的晶体管。

### [jiveturkey](<https://news.ycombinator.com/item?id=50633640>)

> 遗憾的是，调查的答案只是一个脚注。
>
> \> 4 原来测试是故意休眠的：它是在检查 uv_hrtime 在休眠期间移动了多少。这种情况下没什么可优化的。
>
> 此外，也没有解释为什么他没有深入调查 epoll_wait()。我猜是因为这是一个阻塞调用，不是故意休眠，而且那个故意休眠的时间被放大了 600 倍？epoll_wait() 显示消耗了 3 倍的挂钟时间，但在缩短分析中，nanosleeps 加起来显示的休眠时间更多。我对此有点困惑。
>
> 好文章，如果有更多编辑润色就更好了。如果能看到一个真正解决问题的示例那就更棒了。

---

## Cite

- Page: https://zeli.app/zh/story/50626413
- Date: 2026-11-24
- Source: fzakaria.com (https://fzakaria.com/2026/11/12/worshipping-at-the-altar-of-brendan-gregg)
- Hacker News: https://news.ycombinator.com/item?id=50626413

## Other languages

- en: https://zeli.app/story/50626413 · markdown: https://zeli.app/story/50626413.md
- ja: https://zeli.app/ja/story/50626413 · markdown: https://zeli.app/ja/story/50626413.md
- ko: https://zeli.app/ko/story/50626413 · markdown: https://zeli.app/ko/story/50626413.md
- de: https://zeli.app/de/story/50626413 · markdown: https://zeli.app/de/story/50626413.md
- es: https://zeli.app/es/story/50626413 · markdown: https://zeli.app/es/story/50626413.md
- ru: https://zeli.app/ru/story/50626413 · markdown: https://zeli.app/ru/story/50626413.md
