(Rust-Java profiler), similar to async-profiler.
# Build everything
make build
# Quick test with Hello World
make run-hello
# Test with Spring Boot application (builds and runs automatically)
make run-spring
# Profile your own JAR
make profile JAR=myapp.jar ARGS="--spring --mode user"
This project uses a Cargo workspace with two main components:
librjprof/
- Core profiling library using JVMTIrjprof-cli/
- Command-line interface and toolsexamples/
- Sample applications for testing
make build # Release build
make dev # Debug build (faster)
make install # Build and copy binaries to bin/
cargo build --release --workspace
- Rust (latest stable)
- Java Development Kit (JDK 8+) with
JAVA_HOME
set - Maven (for Spring demo)
- Optional: flamegraph.pl or inferno-flamegraph for SVG generation
# Profile any JAR file
./target/release/rjprof --jar myapp.jar
# Profile with Spring filtering (removes framework noise)
./target/release/rjprof --jar myapp.jar --spring
# Focus on user code only
./target/release/rjprof --jar myapp.jar --mode user
# Filter by performance thresholds
./target/release/rjprof --jar myapp.jar --min-pct 0.5 --min-total 1ms
# Custom package filtering
./target/release/rjprof --jar myapp.jar --exclude "java.*,org.apache.*" --include "com.mycompany.*"
# Different sorting and output options
./target/release/rjprof --jar myapp.jar --sort total --export json --no-color
# Verbose output with flamegraph generation
./target/release/rjprof --jar myapp.jar --verbose --generate-flamegraph
all
- Profile everything (can be noisy)user
- Focus on user code, exclude JDK/framework (default)hotspots
- Only methods above performance thresholdsallocation
- Focus on allocation-heavy methods
Target | Description |
---|---|
make build |
Build release version |
make dev |
Build debug version (faster) |
make test |
Run all tests |
make run-hello |
Quick test with Hello World |
make run-spring |
Test with Spring Boot demo |
make flamegraph |
Generate SVG from last run |
make clean |
Clean build artifacts |
make help |
Show all available targets |
- Spring Boot optimized - Automatically filters common Spring/framework noise
- Custom package filtering - Include/exclude specific packages
- Performance thresholds - Hide methods below time/percentage limits
- Profile modes - Focus on different aspects of performance
- Colorized console output - Easy-to-read performance reports
- JSON export - Machine-readable data
- CSV export - Spreadsheet-compatible format
- Flamegraph generation - Visual performance analysis
- Method entry/exit timing - Precise performance measurement
- Memory allocation tracking - Find allocation hotspots
- Call graph analysis - Understand call relationships
- Sampling support - Low-overhead profiling option
# Automatic: builds Spring demo and profiles it
make run-spring
# Manual: profile existing Spring JAR
./target/release/rjprof \
--jar myspring.jar \
--spring \
--mode user \
--min-pct 0.1 \
--sort self \
--generate-flamegraph
./target/release/rjprof \
--jar microservice.jar \
--exclude "java.*,javax.*,org.springframework.*,org.apache.*" \
--include "com.mycompany.*" \
--mode hotspots \
--min-total 5ms \
--export json
./target/release/rjprof \
--jar myapp.jar \
--mode allocation \
--sort calls \
--min-self-time 100us
Generate visual flamegraphs for performance analysis:
# Run profiler with flamegraph generation
./target/release/rjprof --jar myapp.jar --generate-flamegraph
# Or generate from existing data
make flamegraph
Flamegraphs are saved to profiler_output/flamegraph.svg
.
make test # Run all tests
cargo test --workspace # Manual test execution
make check # Check code without building
cargo clippy --workspace # Run linter
cargo fmt --workspace # Format code
- Use
--mode user
for most applications to focus on your code - Enable
--spring
for Spring Boot apps to reduce noise - Set thresholds with
--min-pct
and--min-total
to hide trivial methods - Generate flamegraphs for visual analysis of performance bottlenecks
- Export to JSON for integration with other analysis tools
# Manually specify agent path
./target/release/rjprof --jar myapp.jar --agent-path ./target/release/librjprof.dylib
# Ensure JAVA_HOME is set correctly
export JAVA_HOME=$(/usr/libexec/java_home) # macOS
export JAVA_HOME=/usr/lib/jvm/default # Linux
# Clean and rebuild
make clean
make build
# Check dependencies
cargo check --workspace
Licensed under either of:
- Apache License, Version 2.0
- MIT License