• Stars
    star
    412
  • Rank 101,261 (Top 3 %)
  • Language
    Perl
  • License
    ISC License
  • Created over 10 years ago
  • Updated about 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Flame Graph profiler for Erlang

eflame

Flame Graphs for Erlang. Uses erlang:trace/3 API.

screenshot

Further development of eflame using proper stack sampling-based profiling and experimental Erlang tracing changes are available under Scott Lystig Fritchie's fork. It also contains amazing peeks inside Riak. Make sure to check out his talk, Actively Measuring And Profiling Erlang Code.

Usage example: https://github.com/proger/active/commit/81e7e40c9dc5a4666742636ea4c5dfafc41508a5

> eflame:apply(normal_with_children, "stacks.out", my_module, awesome_calculation, []).
> eflame:apply(my_module, awesome_calculation, []). % same as above
> eflame:apply(fun my_module:awesome_calculation/0, []). % same as above
> eflame:apply(fun awesome_calculation/0, []). % same as above, when called in my_module.erl
> eflame:apply(normal, "stacks.out", my_module, awesome_calculation, []). % won't trace children
$ stack_to_flame.sh < stacks.out > flame.svg
$ open flame.svg

Notes

  • as stacks are collected through tracing, blocking calls are noticed and are drawn in blue

  • unlike the reference implementation, flamegraph.pl does not sort the input to preserve the order of calls (since this is possible due to current method of collecting stacks)

$ grep 0.90.0 stacks.out | deps/eflame/flamegraph.pl > flame.svg

# this invocation draws a separate flame graph for each traced process
$ for pid in $(cat stacks.out | awk -F';' '{print $1}' | uniq | tr -d '<>'); do
    grep $pid stacks.out | deps/eflame/flamegraph.pl --title="$pid" > flame_$pid.svg;
done

# you may also use stacks_to_flames.sh (uses zsh)
$ deps/eflame/stacks_to_flames.sh stacks.out

More examples

Of course you can also apply a bazillion of transformations to get a more understandable stack, for example:

$ grep 0.90.0 stacks.out | sort | uniq -c | sort -n -k1 | sort -k2 | awk '{print $2, "", $1}' > stacks.90
$ perl -pi -e 's#eflame:apply/5;rebar_core:process_commands/2;##' stacks.90
$ perl -pi -e 's#rebar_core:execute/.;##g' stacks.90
$ perl -pi -e 's#rebar_core:process_dir.?/.;##g' stacks.90
$ perl -pi -e 's#rebar_core:process_each/.;##g' stacks.90
$ perl -pi -e 's#rebar_core:run_modules\w*/.;##g' stacks.90
$ perl -pi -e 's#lists:\w+/.;##g' stacks.90
$ perl -pi -e 's#/\d+;#;#g' stacks.90
$ perl -pi -e 's#io_lib_pretty:[^;]+;##g' stacks.90
$ cat stacks.90 | sort -k1 | deps/eflame/flamegraph.pl --width=1430 > flame.svg

The following picture is a cleaned flame graph for a run of rebar compile (using active) on a project with 15 dependencies where all files are already compiled:

rebar compile cleaned flame graph

More Repositories

1

erldocker

Docker Remote API client for Erlang
Erlang
84
star
2

erlsh

Erlang shell tools
Erlang
61
star
3

active

Active development for Erlang: rebuild and reload source/binary files while the VM is running
Erlang
51
star
4

fsevent_watch

simple but awesome OS X FSEvents client
C
49
star
5

erlfsmon

Erlang filesystem event watcher frontend for fswatch
Erlang
30
star
6

darwinkit

Darwin scripts toolbox
D
23
star
7

mod_pushoff

Send empty push notifications for offline queue messages in ejabberd
Erlang
19
star
8

uk

Фонограми та синтагми: інструменти обробки
Python
16
star
9

python2nix

Put a PyPI package name in, get a Nix expression out.
Python
13
star
10

fanotify_watch

simple but awesome Linux fanotify client
C
13
star
11

uk4b

GPT-2 Metadata Pretraining Towards Instruction Finetuning for Ukrainian
Python
13
star
12

dtrace-objc-leakobj

Autogenerate DTrace providers for Objective-C methods and inject them at runtime
Python
12
star
13

haloop

Agent toolkit for 100 hours of speech and 10 GiB of text
Python
10
star
14

st3

STT for TorchScript
Python
9
star
15

utxo-dump

Bitcoind chainstate UTXOs to CSV
Python
8
star
16

accelerated-scan

Accelerated First Order Parallel Associative Scan
Cuda
7
star
17

lxperf

linux introspection tools like https://github.com/brendangregg/perf-tools
Haskell
7
star
18

hl7

HL7 v3 (XML)
Python
6
star
19

unixconf

aka dotfiles
Shell
6
star
20

urc

Ur/web chatroom
UrWeb
5
star
21

homotopy-notes

WIP Analytic Homotopy Theory Notes
TeX
5
star
22

mrf

Markov Random Field Code
C++
5
star
23

oco

Preview audio datasets on your remote machine.
Python
4
star
24

httpipe

HTTP<->Shell pipe
Erlang
4
star
25

nix-adhoc

Hacks to make nix module system-based services runnable on non-NixOS systems
Nix
4
star
26

hastache-aeson

Aeson support for Hastache
Haskell
4
star
27

bigdata

a cookbook for stream processing
Jupyter Notebook
3
star
28

nsf

Neural Source Filter
Python
3
star
29

upcast

nix-build remotely, no unnecessary copying of store paths!
Haskell
3
star
30

pyelf

elftoolchain libdwarf/libelf cython bindings
Python
3
star
31

bitfield

visualize little-endian bit ops
Python
2
star
32

exhar

read HARs & replay requests in Elixir
Elixir
2
star
33

godelt

PL playground
Haskell
2
star
34

vimrc

.vimrc and stuff
Vim Script
2
star
35

erlkit

Erlang Introspection Kit
Erlang
2
star
36

openssl-make-ca

openssl self-signed certificates with a makefile
Makefile
2
star
37

airquake

quick port of android glesquake to Marmalade
C
2
star
38

libcxxabi-cppfilt

C
2
star
39

haskell-dstm

fork of DSTM Hackage library — Distributed STM for Haskell
Haskell
2
star
40

boiler

boiler indexes wavs
Jupyter Notebook
2
star
41

astpy

Python AST transformations library
Python
2
star
42

mod_trunk

ejabberd lightweight HTTP->XMPP trunk
Erlang
1
star
43

gecbot

Macaulay2
1
star
44

etftp

Erlang
1
star
45

gridworld

JavaScript
1
star
46

inquiry

C++
1
star
47

whobot

who is in the office? (haskell-hubot madness)
C
1
star
48

abs

my archlinux pkgbuilds
1
star
49

unsafenix

nix without nixpkgs
Nix
1
star
50

net_tcp

.NET WCF net.tcp implementation in Erlang
Erlang
1
star
51

CXFunctor

Objective-C
1
star
52

gir

voxoz dumb build bot
Erlang
1
star
53

inspect

virtual memory inspection framework
C
1
star
54

vae

Why ELBO goes up, but FID goes down
Python
1
star
55

world-model

Discrete world modeling by recording Coppelia simulations with ROS
Python
1
star
56

vega-remote

HTML
1
star
57

r9

resnet9 for personal computing
Python
1
star
58

octopus

Haskell
1
star
59

flaky-librispeech

LibriSpeech with corrupted labels
Propeller Spin
1
star
60

initram

initramfs scripts for linux kernel
Shell
1
star
61

hsdup

Haskell
1
star
62

otter

kaldi experiments
C++
1
star
63

mova122

Через рік стане краще
Makefile
1
star
64

scroll

HTML
1
star