spaa_parse is both an executable binary that can be run, and a library that can be used in Rust programs.
Installing the spaa_validate executable
Assuming you have Rust/Cargo installed , run this command in a terminal:
cargo install spaa_parse
It will make the spaa_validate command available in your PATH if you've allowed the PATH to be modified when installing Rust . cargo uninstall spaa_parse uninstalls.
Adding spaa_parse library as a dependency
Run this command in a terminal, in your project's directory:
cargo add spaa_parse
To add it manually, edit your project's Cargo.toml file and add to the [dependencies] section:
spaa_parse = "0.1.1"
The spaa_parse library will be automatically available globally.
Read the spaa_parse library documentation .
Back to the crate overview .
Readme
spaa_parse
Parser and writer for SPAA (Stack Profile for Agentic Analysis) files.
SPAA is a structured format for representing profiling data from tools like Linux perf , DTrace, and Chrome DevTools. It's designed for analysis by both humans and LLMs.
Usage
Reading SPAA Files
use std:: fs:: File;
use spaa_parse:: SpaaFile;
let file = File:: open( " profile.spaa" ) . unwrap ( ) ;
let spaa = SpaaFile:: parse( file) . unwrap ( ) ;
println! ( " Source tool: {} " , spaa. header. source_tool) ;
println! ( " Stacks: {} " , spaa. stacks. len ( ) ) ;
// Iterate over stacks for a specific event
for stack in spaa. stacks_for_event ( " cycles" ) {
println! ( " Stack {} has {} frames" , stack. id, stack. frames. len ( ) ) ;
}
Writing SPAA Files
use std:: fs:: File;
use spaa_parse:: { SpaaWriter, Header, Dso, Frame, Stack} ;
let file = File:: create( " output.spaa" ) . unwrap ( ) ;
let mut writer = SpaaWriter:: new( file) ;
// Write header first, then dictionaries (DSOs, frames), then stacks
writer. write_header ( & header) . unwrap ( ) ;
writer. write_dso ( & dso) . unwrap ( ) ;
writer. write_frame ( & frame) . unwrap ( ) ;
writer. write_stack ( & stack) . unwrap ( ) ;
License
MIT