{"id":17964802,"url":"https://github.com/kzemek/erlang_pmp","last_synced_at":"2025-03-25T06:31:01.675Z","repository":{"id":51374932,"uuid":"142030566","full_name":"kzemek/erlang_pmp","owner":"kzemek","description":"FlameGraph compatible, Poor Man's Profiler inspired Erlang profiler","archived":false,"fork":false,"pushed_at":"2021-05-12T22:40:23.000Z","size":11,"stargazers_count":12,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-19T09:21:11.337Z","etag":null,"topics":["elixir","erlang","flame","flamegraph","graph","pmp","profile","profiler","profiling"],"latest_commit_sha":null,"homepage":null,"language":"Erlang","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kzemek.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-07-23T15:06:02.000Z","updated_at":"2021-11-12T11:41:52.000Z","dependencies_parsed_at":"2022-08-28T14:00:41.852Z","dependency_job_id":null,"html_url":"https://github.com/kzemek/erlang_pmp","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kzemek%2Ferlang_pmp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kzemek%2Ferlang_pmp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kzemek%2Ferlang_pmp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kzemek%2Ferlang_pmp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kzemek","download_url":"https://codeload.github.com/kzemek/erlang_pmp/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245413575,"owners_count":20611350,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["elixir","erlang","flame","flamegraph","graph","pmp","profile","profiler","profiling"],"created_at":"2024-10-29T12:08:45.760Z","updated_at":"2025-03-25T06:31:01.437Z","avatar_url":"https://github.com/kzemek.png","language":"Erlang","funding_links":[],"categories":[],"sub_categories":[],"readme":"## erlang_pmp\n\n[![Hex pm](http://img.shields.io/hexpm/v/erlang_pmp.svg?style=flat)](https://hex.pm/packages/erlang_pmp)\n\n[Poor Man's Profiler](https://poormansprofiler.org/) inspired Erlang profiler.\n\n### Running\n\n```erlang\nerlang_pmp:profile(Opts).\n```\n\n#### Opts\n\n* `duration`: duration the profiling will run for, in seconds (default: `60`).\n* `processes`: list of PIDs that will be profiled, or `all` to use\n  [`erlang:processes()`](http://erlang.org/doc/man/erlang.html#processes-0) before taking each sample (default: `all`).\n* `sleep`: sleep duration in milliseconds between taking samples (default: `10`).\n* `show_pid`: if `true`, PID (or process name if registered) will be prepended to the stack trace (default: `false`).\n* `filename`: path under which the profiling results will be saved (default: `/tmp/erlang_pmp.trace`).\n* `include_statuses`: a list of process statuses as returned from\n  [`erlang:process_info(Pid, status)`](http://erlang.org/doc/man/erlang.html#process_info-2).\n  A stack trace will only be counted if the process status belongs to the list, or if `include_statuses` is `all` (default: `all`).\n* `show_status`: if `true`, status of the process will be appended to the stack trace (default: `false`)\n\n#### Output\n\nThe output of `erlang_pmp` is meant to be used with [FlameGraph stack trace visualizer](https://github.com/brendangregg/FlameGraph):\n\n```\ngit clone https://github.com/brendangregg/FlameGraph.git\nFlameGraph/flamegraph.pl /tmp/erlang_pmp.trace \u003e /tmp/erlang_pmp.svg\n```\n\n#### Examples\n\nFirst it is good to increase the depth of captured call stacks, which by default are 8 frames only.\n\n```\nerlang:system_flag(backtrace_depth, 128).\n```\n\nThe 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.\n\n```\nerlang_pmp:profile([{duration, 30}, {include_statuses, [exiting, garbage_collecting, running, runnable, suspended]}, {show_status, true}, {show_pid, true}]).\n```\n\nIf the system has many processes, we sample stacks less frequently and don't show individual pids:\n\n```\nerlang_pmp:profile([{duration, 30}, {include_statuses, [exiting, garbage_collecting, running, runnable, suspended]}, {show_status, true}, {sleep,50}]).\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkzemek%2Ferlang_pmp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkzemek%2Ferlang_pmp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkzemek%2Ferlang_pmp/lists"}