rspack-sftrace

Trace Rust function calls and convert them to perfetto protobuf traces.

12.8k|834|Updated Apr 1, 2022
One-click install
npx skills add https://github.com/web-infra-dev/rspack --skill rspack-sftrace
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: rspack-sftrace
Source: https://github.com/web-infra-dev/rspack/tree/main/.agents/skills/rspack-sftrace
Command: npx skills add https://github.com/web-infra-dev/rspack --skill rspack-sftrace

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill enables tracing of Rust function calls with sftrace to help analyze performance and troubleshoot rspack. It converts traces into perfetto protobufs for downstream tooling.

Core Features & Use Cases

  • Instrumentation-based Rust tracing with sftrace to capture function call data.
  • End-to-end workflow: build sftrace, compile the Rust bindings, record traces, and convert them for analysis.
  • Use Case: Profile rspack during development to identify hot paths, then visualize traces with Perfetto or viztracer.

Quick Start

Clone and build sftrace, build the binding, record a trace, and analyze it with perfetto: git clone https://github.com/quininer/sftrace cd sftrace cargo build --release mkdir "$(./target/release/sftrace record --print-solib-install-dir)" cp ./target/release/libsftrace.so "$(./target/release/sftrace record --print-solib-install-dir)/" SFTRACE=1 pnpm run build:binding:debug cd examples/basic/ sftrace record -- pnpm build sftrace convert sf.log -o sf.pb.gz vizviewer --use_external_processor sf.pb.gz

Frequently Asked Questions about rspack-sftrace

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I trace Rust function calls to profile rspack performance?

Trace Rust function calls by building sftrace, compiling the Rust bindings with the SFTRACE flag, recording the execution, and converting the output to a perfetto protobuf for visualization.

How does sftrace instrumentation work for analyzing Rust performance?

sftrace instruments Rust function calls during execution to capture performance data, targeting hot paths and troubleshooting bottlenecks within rspack's Rust code for downstream analysis.

What is the step by step process to record and convert perfetto traces from Rust?

Record perfetto traces by running sftrace record during your build, then use sftrace convert to transform the sf.log output into a compressed perfetto protobuf file like sf.pb.gz.

Do I need to build sftrace and Rust bindings from source to capture function traces?

Yes, you need to clone and build sftrace from source, install the shared library to the designated directory, and compile the Rust bindings in debug mode to enable instrumentation.

Can I visualize sftrace output using viztracer and perfetto?

Yes, after converting the sftrace log to a perfetto protobuf, you can load the trace file into vizviewer with the external processor flag or analyze it directly in perfetto.

What are the limitations of using sftrace for Rust performance profiling?

sftrace requires a debug build of the Rust bindings and manual setup of the shared library directory, meaning it targets development profiling rather than production performance tracing.