Skip to content

Commit 5ea17c9

Browse files
authored
chore: add rspack-sftrace skill (#12911)
1 parent c3b14c0 commit 5ea17c9

File tree

1 file changed

+51
-0
lines changed

1 file changed

+51
-0
lines changed
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
---
2+
name: rspack-sftrace
3+
description: Use sftrace, which is based on LLVM Xray instrumentation, to trace all Rust function calls. This can be used for performance analysis and troubleshooting.
4+
---
5+
6+
# Rspack Sftrace
7+
8+
## Overview
9+
10+
Use sftrace to trace rspack's Rust function calls and convert them to perfetto protobuf format for performance analysis and troubleshooting.
11+
12+
## Workflow
13+
14+
### 1) Build sftrace tools
15+
16+
```sh
17+
git clone https://github.com/quininer/sftrace
18+
cd sftrace
19+
cargo build --release
20+
mkdir "$(./target/release/sftrace record --print-solib-install-dir)"
21+
cp ./target/release/libsftrace.so "$(./target/release/sftrace record --print-solib-install-dir)/"
22+
```
23+
24+
### 2) Build sftrace-enabled binding (once per code change)
25+
26+
```sh
27+
SFTRACE=1 pnpm run build:binding:debug
28+
```
29+
30+
### 3) Record sftrace (examples/basic)
31+
32+
```sh
33+
cd examples/basic/
34+
sftrace record -- pnpm build
35+
```
36+
37+
### 4) Analyze sf.log
38+
39+
Convert sftrace log to perfetto protobuf format.
40+
41+
```sh
42+
sftrace convert sf.log -o sf.pb.gz
43+
```
44+
45+
### 5) Optional: Visualization using [viztracer](https://github.com/gaogaotiantian/viztracer)
46+
47+
```sh
48+
vizviewer --use_external_processor sf.pb.gz
49+
```
50+
51+
Use this only for visualization.

0 commit comments

Comments
 (0)