| Crates.io | ferric-ai |
| lib.rs | ferric-ai |
| version | 0.3.0 |
| created_at | 2025-09-25 19:24:14.808832+00 |
| updated_at | 2025-09-28 22:14:07.060445+00 |
| description | Comprehensive flamegraph analysis CLI with intelligent hotspot detection, source code attribution, allocation analysis, and LLM-friendly structured output for performance optimization |
| homepage | https://github.com/dolly-parseton/ferric |
| repository | https://github.com/dolly-parseton/ferric |
| max_upload_size | |
| id | 1855026 |
| size | 211,731 |
LLM-friendly flamegraph analysis tool with comprehensive statistical analysis and performance health assessment.
Developer note: I made this project over the course of 48 hours as a way of learning how to optimally pair program with an LLM, in my case I was using Claude Code. Really happy with these results but of course there's more testing I'll need to do but as I run this on more complex code doing more performant tasks I'll make changes to this tool. There were some very interesting use cases for this kind of tool, having something that presents results in a LLM efficent way has some interesting consequences.
cargo install ferric-ai
# Or from source
git clone https://github.com/dolly-parseton/ferric.git
cd ferric
cargo build --release
Below is the current functionality. I suggest using an LLM-backed coding assistant like Claude Code to run ferric and analyze the results - the structured output is designed for AI interpretation.
# 1. Basic flamegraph analysis
ferric -f app.svg stats summary --json
# 2. Identify performance hotspots
ferric -f app.svg stats hotspots --json
# 3. Get optimization recommendations
ferric -f app.svg stats diagnosis --json
# 4. Analyze statistical distribution
ferric -f app.svg stats distribution --json
# 5. Complete analysis (all metrics)
ferric -f app.svg stats comprehensive --json
# 6. Compare before/after performance
ferric -f before.svg -c after.svg stats comprehensive --json
All stats subcommands support --json for structured output and -c/--compare for before/after analysis.
# Basic flamegraph inventory
ferric -f app.svg stats summary [--json]
# CPU concentration analysis and performance tiers
ferric -f app.svg stats hotspots [--json]
# Health assessment and optimization recommendations
ferric -f app.svg stats diagnosis [--json]
# Statistical distribution patterns and variability analysis
ferric -f app.svg stats distribution [--json]
# Complete analysis combining all metrics
ferric -f app.svg stats comprehensive [--json]
# Comparison analysis (before vs after)
ferric -f before.svg -c after.svg stats [subcommand] [--json]
# Pretty-print flamegraph as formatted call tree
ferric -f app.svg pretty-print
# LLM guidance and documentation
ferric -f app.svg llm-guide
{
"filename": "app.svg",
"basic_stats": {
"total_functions": 33,
"root_functions": 2,
"leaf_functions": 3,
"max_depth": 25,
"total_cpu_percent": 100.0,
"total_samples": 35280497
},
"concentration_metrics": {
"top_1_cpu": 54.426,
"top_3_cpu": 99.976,
"top_5_cpu": 100.0,
"top_10_cpu": 100.0,
"gini_coefficient": 0.701,
"efficiency_ratio": 0.333
},
"performance_tiers": {
"critical": [["main", 54.426], ["fib_recursive", 11.670]],
"high": [],
"medium": [],
"low": [["[ld-linux-x86-64.so.2]", 0.656]],
"minimal": [["[unknown]", 0.024]],
"zero_count": 22
}
}
{
"filename": "app.svg",
"analysis_results": {
"basic": {
"total_functions": 33,
"max_depth": 25,
"total_samples": 35280497
},
"concentration": {
"top_1_cpu": 54.426,
"gini_coefficient": 0.701
},
"statistical_shape": {
"skewness": 2.660,
"kurtosis": 7.806,
"coefficient_of_variation": 175.829,
"spread_ratio": 106.300,
"percentiles": {
"p10": 0.0002,
"p25": 0.025,
"p50": 0.656,
"p75": 11.212,
"p90": 11.670
}
},
"health": {
"hotspot_severity": "Critical",
"work_distribution": "Critical",
"optimization_priority": "Critical",
"recommended_action": "Focus on optimizing top function for 54.4% improvement potential"
}
}
}
The best approach is to ask your LLM coding assistant to run ferric commands directly. The tool provides comprehensive help text and structured JSON output designed for AI interpretation.
# Phase 1: Initial Assessment
ferric -f app.svg stats summary --json
# Phase 2: Identify Bottlenecks
ferric -f app.svg stats hotspots --json
# Phase 3: Get Recommendations
ferric -f app.svg stats diagnosis --json
# Phase 4: Statistical Analysis
ferric -f app.svg stats distribution --json
# Phase 5: Compare Improvements
ferric -f before.svg -c after.svg stats comprehensive --json
clap, serde, quick-xml, regex, chrono, uuid, glob)| Component | Purpose | Features |
|---|---|---|
| Parser | SVG flamegraph parsing | Tree construction, sample count calculation |
| Stats Analysis | Statistical computation | Concentration metrics, distribution analysis |
| Calculations | Mathematical operations | Robust algorithms, outlier resistance |
| Display | Output formatting | Human-readable and JSON serialization |
| Comparison | Before/after analysis | Delta calculations, regression detection |
Mathematical Accuracy:
Real-World Testing:
Production Ready:
# Rust 2021 edition
cargo build --release
cargo test
cargo clippy --all-targets
src/
โโโ cli/ # Clap-based CLI with stats subcommands
โโโ parser/ # SVG flamegraph parser with tree structures
โโโ commands/ # Command handlers and analysis logic
โ โโโ stats/ # Statistics analysis subcommands
โ โโโ calculations/ # Mathematical operations
โ โโโ subcommands/ # Individual stats handlers
โ โโโ display/ # Output formatting
โโโ helpers.rs # Utility functions and comparison helpers
โโโ handler.rs # Command routing and execution
โโโ error.rs # Custom error types
โโโ main.rs # CLI dispatch and initialization
Licensed under the MIT License. See LICENSE for details.
Dependencies:
Inspiration: