Crates.io | flamelens |
lib.rs | flamelens |
version | 0.3.0 |
source | src |
created_at | 2024-06-29 15:52:55.990255 |
updated_at | 2024-09-27 15:17:55.631392 |
description | Flamegraph viewer in the terminal |
homepage | https://github.com/YS-L/flamelens |
repository | https://github.com/YS-L/flamelens |
max_upload_size | |
id | 1287452 |
size | 168,658 |
flamelens
is an interactive flamegraph viewer in the terminal.
Flamegraph tools such as FlameGraph and
inferno process output from various profiling tools and
generate intermediate data in the "folded" format ready for flamegraph plotting. Instead of plotting
the flamegraph as an SVG file, flamelens
takes the folded stacks data and generate an interactive
flamegraph in the terminal.
No more hauling SVG files and opening a browser just to have a quick look at the profiling result!
Run flamelens
with the filename of the profiling data in the form of "folded stacks":
flamelens <folded-stacks-filename>
You can also pipe data directly to flamelens
without providing a filename.
You can use flamelens
as the viewer of cargo flamegraph
this way:
cargo flamegraph --post-process 'flamelens --echo' [other cargo flamegraph arguments]
The --echo
flag ensures that the flamegraph SVG file is also generated by cargo flamegraph
on
exit.
perf
dataIf have a perf.data
file generated by perf
(e.g. by using cargo flamegraph
to profile your
program in Linux), you can visualize it in flamelens
this way with the help of
inferno:
perf script -i perf.data | inferno-collapse-perf | flamelens
See inferno on generating folded stacks data from profiling data of different formats.
Display a live flamegraph of a running Python program using
py-spy
as the profiler:
flamelens --pid <pid-of-python-program>
This requires enabling the python
feature when installing.
Key | Action |
---|
hjkl
(or ← ↓ ↑→
) | Navigate cursor for frame selection
f
| Scroll down
b
| Scroll up
G
| Scroll to bottom
g
| Scroll to top
Enter
| Zoom in on the selected frame
Esc
| Reset zoom
/<regex>
| Find and highlight frames matching the regex
#
| Find and highlight frames matching the selected frame
n
| Jump to next match
N
| Jump to previous match
r
| Reset to default view
z
(in Live mode) | Freeze the flamegraph
q
(or Ctrl + c
) | Exit
If you have Rust installed, flamelens
is available on
crates.io and you can install it using:
cargo install flamelens --locked
If you want the live flamegraph functionality, install with the --all-features
option:
cargo install flamelens --locked --all-features
Alternatively, build and install from source after cloning this repo:
cargo install --path $(pwd) --locked