Giter VIP home page Giter VIP logo

erlang_pmp's Introduction

erlang_pmp

Hex pm

Poor Man's Profiler inspired Erlang profiler.

Running

erlang_pmp:profile(Opts).

Opts

  • duration: duration the profiling will run for, in seconds (default: 60).
  • processes: list of PIDs that will be profiled, or all to use erlang:processes() before taking each sample (default: all).
  • sleep: sleep duration in milliseconds between taking samples (default: 10).
  • show_pid: if true, PID (or process name if registered) will be prepended to the stack trace (default: false).
  • filename: path under which the profiling results will be saved (default: /tmp/erlang_pmp.trace).
  • include_statuses: a list of process statuses as returned from erlang:process_info(Pid, status). A stack trace will only be counted if the process status belongs to the list, or if include_statuses is all (default: all).
  • show_status: if true, status of the process will be appended to the stack trace (default: false)

Output

The output of erlang_pmp is meant to be used with FlameGraph stack trace visualizer:

git clone https://github.com/brendangregg/FlameGraph.git
FlameGraph/flamegraph.pl /tmp/erlang_pmp.trace > /tmp/erlang_pmp.svg

Examples

First it is good to increase the depth of captured call stacks, which by default are 8 frames only.

erlang:system_flag(backtrace_depth, 128).

The below example is useful in scenarios when we want to sample all processes to get an idea of the overall system profile. We omit the waiting state to focus on busy processes only.

erlang_pmp:profile([{duration, 30}, {include_statuses, [exiting, garbage_collecting, running, runnable, suspended]}, {show_status, true}, {show_pid, true}]).

If the system has many processes, we sample stacks less frequently and don't show individual pids:

erlang_pmp:profile([{duration, 30}, {include_statuses, [exiting, garbage_collecting, running, runnable, suspended]}, {show_status, true}, {sleep,50}]).

erlang_pmp's People

Contributors

kzemek avatar michalslaski avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

tmp-reg

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.