investigate-puffin
Skill này làm gì
Skill này giúp AI mở một bản ghi profiler Puffin và tìm phần nào của ứng dụng tốn nhiều thời gian nhất. Skill dành cho developer muốn kiểm tra hiệu năng trước và sau một thay đổi.
Khi nào nên dùng
- ✓Khi bạn có một file .puffin và muốn biết đoạn code nào chậm.
- ✓Khi bạn muốn so sánh một trace trước thay đổi với một trace sau thay đổi.
- ✓Khi bạn yêu cầu AI dùng lệnh rerun dump-puffin để đọc một profile.
Liên kết skill
https://github.com/rerun-io/rerun/blob/main/skills/investigate-puffin/SKILL.mdSao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.
Cách dùng
Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.
Tin nhắn có sẵn để dán
Dành cho Claude Code, Codex hoặc Cursor: chạy lệnh trong thư mục dự án của bạn và skill sẽ được cài đặt.
Tải tệp SKILL.md về và thả vào thư mục skill của agent.
Ví dụ cách nhờ AI
“Xem bản ghi .puffin này và cho tôi biết hàm nào tốn nhiều thời gian nhất.”
5 skill mới mỗi tuần. Đọc chỉ 1 phút.
Cách hoạt động
Skill chuyển bản ghi sang JSON bằng lệnh rerun dump-puffin, rồi dùng vài script trợ giúp nhỏ để tìm scope chậm nhất và so sánh hai lần chạy.
Nội dung kỹ thuật (SKILL.md gốc)
Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.
Investigate puffin traces
Analyze a .puffin recording from an application instrumented with Puffin.
Use the recording path supplied by the user. Or use the capture_profile_trace message if using the rerun MCP.
Setup
Requires the rerun CLI (Rerun 0.38 or later), Python 3.10 or later, and jq.
The Python helpers use only the standard library.
Set PUFFIN_SKILL_DIR to the absolute directory containing this SKILL.md.
In Claude Code, you can use export PUFFIN_SKILL_DIR="${CLAUDE_SKILL_DIR}"; in other agents, resolve the directory from the installed skill location.
Dump the trace to a file and check scope registration:
rerun dump-puffin <path> > /tmp/puffin.json
jq '.scopes | length' /tmp/puffin.json
If no (recent enough) rerun binary is on the path but you are in a Rerun checkout, run the sub-command from source instead:
cargo run --quiet -p rerun-cli --no-default-features -- dump-puffin <path> > /tmp/puffin.json
Always dump to a file.
.puffin traces can produce many MB of JSON, so query the saved JSON instead of reading it all into context.
If .scopes | length is 0, names fall back to scope#<id> and source locations are missing.
Ask for a new capture that includes scope registration if names are needed for the investigation.
If another capture is not feasible, proceed with dynamic data labels and explain the limits.
Check the registration table after exporting: do not assume that every capture tool or version preserves it.
How traces are captured
Use the application's Puffin capture or export support to save a .puffin file.
For applications serving profiling data through puffin_http, connect a compatible puffin_viewer and export the recording.
The dumper uses Puffin 0.20; captures from incompatible format versions may require a matching parser.
Rerun-specific examples:
- Native viewer / CLI: enable the built-in Puffin server from the UI.
- Python SDK: set
RERUN_PUFFIN=1before importingrerunto stream profiling data topuffin_viewer. - Rust binaries using
re_tracing: keep are_tracing::Profileralive for the capture and call itsstart()method with server support enabled. It starts a server and attempts to launchpuffin_viewer.
Investigate with jq
The JSON layout:
{
"file": "preview.puffin",
"scopes": { "<id>": { name, function, file, line, kind } }, # may be empty — see Setup
"frames": [
{
"frame_index": …,
"range_ns": [start, end],
"duration_ns": …,
"num_scopes": …,
"threads": [
{
"name": "main",
"num_scopes": …, "depth": …, "range_ns": […],
"scopes": [ { id, name, start_ns, duration_ns, data, children: […] } ]
}
]
}
]
}
name on each scope is resolved from the scopes map.
data is the dynamic per-call string, such as an event type or a mesh name.
Recipes
Footgun: any .. | objects | select(.name? == …) pattern MUST also select(has("duration_ns")).
.. walks every object in the tree, including entries in the top-level scopes registration map, which have .name but no .duration_ns.
Without the guard you will hit null / 1e6 errors or sort against null.
Every recipe below includes the guard, keep it when adapting them.
Prefer find_scopes.py for name/data lookups. If you just want "slowest matches of X", "total time grouped by name" or "all scopes matching X on thread Y", reach for find_scopes.py instead of writing jq, it's shorter and bakes the guard in.
See "Looking for a scope by prefix" below.
Use the jq recipes here when you need something the script does not cover (children of a specific scope, cross-thread windows, time-ordered traversal).
# overall shape — sorted slowest first so the bad frames jump out
jq '.frames | map({i: .frame_index, ms: (.duration_ns / 1e6), scopes: .num_scopes}) | sort_by(-.ms)' /tmp/puffin.json
# per-thread totals for the slowest frame
jq '.frames | sort_by(-.duration_ns) | .[0].threads | map({name, num_scopes, depth, ms: ((.range_ns[1] - .range_ns[0]) / 1e6)})' /tmp/puffin.json
# top 10 slowest individual scopes (recursive descent over the whole tree)
# also doable as: find_scopes.py /tmp/puffin.json '' --top 10
jq '[.. | objects | select(has("duration_ns") and has("name"))]
| sort_by(-.duration_ns) | .[0:10]
| map({name, data, ms: (.duration_ns / 1e6)})' /tmp/puffin.json
# total time per scope name (best-effort: group
Câu hỏi thường gặp
Tôi cần cài gì?
Skill cần công cụ dòng lệnh rerun phiên bản 0.38 trở lên, Python 3.10 trở lên và jq.
Vì sao trace được lưu thành file?
Trace Puffin có thể lớn đến nhiều megabyte, nên skill truy vấn file JSON đã lưu thay vì đọc toàn bộ.
Nếu tên trông như scope# thì sao?
Điều đó nghĩa là bản ghi không có tên scope, nên skill sẽ yêu cầu một lần ghi mới có bao gồm tên.
Chi tiết
Mô tả gốc của tác giả
Investigate Puffin profiler recordings (.puffin files), find slow scopes, and compare before/after traces using the `rerun dump-puffin` command and bundled analysis helpers.
repo: rerun-io/rerun
Độ phổ biến
- Sao GitHub
- 12k
- Vị trí xếp hạng
- #11547
- Giấy phép
- Apache-2.0
- Cập nhật
- 2/11/2026
Bình luận
- …
Thêm skill từ kho mã này
rerun-blueprint
12kDạy agent thay đổi giao diện trình xem Rerun bằng cách viết blueprint cho một bản ghi hoặc bảng, gồm bố cục, view và các cột ẩn.
rerun-catalog-queries
12kGiúp agent truy vấn catalog Rerun từ Python nhanh hơn, với các mẹo về số lượt gọi qua lại, dung lượng dữ liệu và việc đọc dataset chậm.
rerun-chunk-processing
12kDạy agent xây dựng pipeline dữ liệu Rerun với reader và lens, chuyển các file MCAP, Parquet, video hoặc RRD thành bản ghi Rerun.
rerun-data-model
12kGiúp agent ánh xạ dữ liệu robot hoặc đa phương thức lên mô hình dữ liệu của Rerun, quyết định entity, component và giá trị tĩnh hay theo thời gian trước.
Skill tương tự
diffs
394kGiúp agent của bạn tạo một diff có thể chia sẻ về các chỉnh sửa, dưới dạng liên kết xem hoặc file ảnh, thay vì một bản tóm tắt viết tay.
coding-agent
394kGiúp agent của bạn giao một việc lập trình lớn cho Codex, Claude Code hoặc OpenCode chạy nền, rồi theo dõi tiến độ của nó.
gh-issues
394kGiúp agent của bạn tìm issue trên GitHub, chọn những issue cần xử lý và mở pull request với bản sửa, kể cả theo dõi nhận xét đánh giá.