| Crates.io | librjprof |
| lib.rs | librjprof |
| version | 0.1.0 |
| created_at | 2025-07-26 18:57:56.073819+00 |
| updated_at | 2025-07-26 18:57:56.073819+00 |
| description | Java profiling library using JVMTI |
| homepage | https://github.com/tkruer/rjprof |
| repository | https://github.com/tkruer/rjprof |
| max_upload_size | |
| id | 1769374 |
| size | 455,846 |
(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 testingmake build # Release build
make dev # Debug build (faster)
make install # Build and copy binaries to bin/
cargo build --release --workspace
JAVA_HOME set# 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 |
# 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
--mode user for most applications to focus on your code--spring for Spring Boot apps to reduce noise--min-pct and --min-total to hide trivial methods# 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: