Skip to content

A toolkit for analyzing and manipulating Samply/Firefox Profileprofiling data.

License

Notifications You must be signed in to change notification settings

xrvdg/samply-kit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Samply Kit (Alpha Release)

A toolkit for analyzing and manipulating Samply/Firefox Profile profiling data. This project provides utilities for filtering, aggregating sample counts per function, and in the future visualizing CPU profiling.

Overview

Samply Kit is a Rust-based collection of tools designed to work with profiling data captured by Samply, a command-line sampling profiler for macOS and Linux. This toolkit allows you to:

  • Filter out specific functions from profiling data using regex patterns
  • Analyze profiling statistics (self time, cumulative time)
  • Perform reverse lookup to find all traces containing a specific function

Usage

preprocess

Filter out unwanted frames from a profile.

Usage:

cargo run --bin preprocess -- <input.json> <output.json> <regex>

NOTE: Profiles recorded with samply are not complete yet they are missing the symbol table, which is needed for function names. To complete the profile, load the profile with samply into the Firefox Profiler UI and download it from there. To download select the poorly named "Upload Local Profile" in the top corner and from there select download.

samply record TARGET
samply load profile.json.gz 

Example:

# Remove all frames matching "rayon" from the profile
cargo run --bin preprocess -- profile.json filtered_profile.json "rayon"

This tool reads a profile, excludes all functions matching the given regex pattern, and writes the filtered profile to the output file.

pprof

Analyze profiling data by aggregating sample counts per function (pprof-style sample attribution). This is useful for finding functions that are called all over the place but in regular flamegraph show up as a small contributor even though in aggregate they are a large contributor.

Usage:

# Show statistics
cargo run --bin pprof -- <profile.json> stat

# Lookup traces containing a specific function
cargo run --bin pprof -- <profile.json> lookup <function_id>

Commands:

  • stat: Display top 25 functions by self-time and cumulative time for the main thread and first worker thread. With Rayon
  • lookup <id>: Show all call traces containing the function sorted by sample count with the given function id. The function ID is the id listed by stat.

Example:`

# View profiling statistics
cargo run --bin pprof -- profile.json stat

# Find all traces containing function with ID 42
cargo run --bin pprof -- profile.json lookup 42

About

A toolkit for analyzing and manipulating Samply/Firefox Profileprofiling data.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published