Skip to content

Cross-stack profiling for Go <-> CGO <- Rust #1582

@Elvis339

Description

@Elvis339

Is your feature request related to a problem? Please describe.

Firewood (Rust) is consumed by AvalancheGo (Go) through CGO. Current profiling tools only see one side:

  • Go pprof: shows C.fwd_propose_on_db as a black box
  • Rust profilers: no visibility into which Go code triggered the call

We cannot trace a hot path across the boundary. Performance work requires guessing or correlating two separate profiles manually.

Describe the solution you'd like

Unified profiling that shows Go -> CGO -> Rust in one call stack.

Describe alternatives you've considered

  • Rust-side metrics: timing only, no call stacks
  • Separate profiles: manual correlation, error-prone

Additional context

Prototype working on macOS with Instruments. Requirements:

  1. Rust FFI with frame pointers (-C force-frame-pointers=yes)
  2. Go binary with debug symbols (-gcflags="all=-N -l")
  3. Local FFI via go.mod replace (module cache lacks debug info)

Linux (perf) workflow needs validation.

Progress (review in order)

  1. feat(vm_reexecute): add pprof profiling support avalanchego#4790 - runs reexecution with optional pprof flag
  2. Es/cross stack profiling #1583 - builds Firewood with debug symbols enabling profiling visibility
  3. feat(reexecution): add optional profiling support to benchmarking script avalanchego#4791 - Connects Es/cross stack profiling #1583 to reexecution preserving Rust debug info

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions