Skip to content

A tool for converting Google gperftools profiler output to FlameGraph visualization format

License

Notifications You must be signed in to change notification settings

Emin017/gperf2flamegraph

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

✨ gperf2flamegraph (g2f) ✨

GitHub Rust Flamegraph Gprof

GitHub GitHub workflows GitHub issues GitHub pull requests GitHub release (latest by date)

GitHub stars GitHub forks

English

A Rust tool for converting Google gperftools CPU profiler output to FlameGraph visualization format.

🔥 Features

  • 📊 Parse binary output from gperftools CPU profiler
  • 🔍 Resolve symbols with demangling support
  • 🧰 Customizable output options for visualization
  • 📝 Generate text format for debugging or further processing
  • 🚀 Performance optimized with Rust

🛠️ Installation

build from source:

cargo build --release

📖 Usage

Basic syntax:

g2f <EXECUTABLE> <PROFILE_FILE> [OPTIONS]

Parameters

  • <EXECUTABLE>: Path to the executable binary that was profiled
  • <PROFILE_FILE>: Path to gperftools CPU profiler result file

Options

Option Description
--help Show help message
--svg-output <PATH> Path for SVG flamegraph output
--text-output <PATH> Path for text format output
--simplify-symbol Simplify symbol names (remove template/function args)
--executable-only Only resolve symbols from the executable (ignore libraries)
--annotate-libname Add library name annotations like [libname.so]
--to-microsecond Use microseconds as time unit (default is sample count)
--flamegraph-path <PATH> Path to flamegraph.pl script (default: "flamegraph.pl")

🧪 Example

Basic Usage

g2f <gprof_output_file> <output_file>

With Options

g2f <EXECUTABLE> gprof.prof --svg-output gprof.svg --text-output gprof.txt

Note: The generated SVG files are best viewed in a modern browser. For large profiles, consider using the --simplify-symbol option to improve readability.

🔧 Troubleshooting

Missing flamegraph.pl

If you encounter "Failed to start flamegraph.pl" error:

# Option 1: Install FlameGraph and specify path
git clone https://github.com/brendangregg/FlameGraph.git
./g2f myapp cpu.prof --svg-output out.svg --flamegraph-path ./FlameGraph/flamegraph.pl

# Option 2: Add FlameGraph to your PATH
export PATH=$PATH:$(pwd)/FlameGraph

Symbol Resolution Issues

If you see too many "???" unknown symbols:

  1. Ensure your binary was compiled with debug information (-g flag)
  2. Check that you're providing the correct executable path

🤝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

📄 License

This project is licensed under the Mulan PSL v2 License - see the LICENSE file for details.

🙏 Acknowledgements

This project is inspired by gperftools_flamegraph_profiler.

About

A tool for converting Google gperftools profiler output to FlameGraph visualization format

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •