dominicletz
Creator of Elixir Desktop
Profiler - Sampling Profiler for Shell Debugging
Hi there,
this is a tool I’ve been using myself quite a bit recently for online debugging and performance analysis. It’s a simple remote shell Sampling Profiler module.
Here you can get it:
https://hexdocs.pm/profiler/Profiler.html
It’s focused on shell usage so all commands print to stdout. Usage is simple after including it in your project. E.g. here it’s used to profiler the Elixir compiler and shows use how much time is % spend in function calls:
iex(diode@leno)3> pid = spawn(fn() -> for _ <- 1..100000, do: Elixir.Code.compile_file("lib/debounce.ex") end)
#PID<0.731.0>
iex(diode@leno)4> Profiler.profile(pid)
96% {:erl_eval, :expr, 5, [file: 'erl_eval.erl', line: 411]}
96% {:erl_eval, :expr_list, 6, [file: 'erl_eval.erl', line: 888]}
96% {:erl_eval, :do_apply, 6, [file: 'erl_eval.erl', line: 680]}
96% {Enum, :reduce_range_inc, 4, [file: 'lib/enum.ex', line: 3371]}
96% {:erl_eval, :expr, 5, [file: 'erl_eval.erl', line: 232]}
96% {:erl_eval, :do_apply, 6, [file: 'erl_eval.erl', line: 680]}
78% {Code, :compile_file, 2, [file: 'lib/code.ex', line: 1157]}
74% {:elixir_compiler, :quoted, 3, [file: 'src/elixir_compiler.erl', line: 18]}
74% {:elixir_lexical, :run, 3, [file: 'src/elixir_lexical.erl', line: 14]}
74% {:elixir_compiler, :eval_forms, 3, [file: 'src/elixir_compiler.erl', line: 46]}
73% {:elixir, :eval_forms, 3, [file: 'src/elixir.erl', line: 263]}
73% {:elixir, :recur_eval, 3, [file: 'src/elixir.erl', line: 278]}
73% {:erl_eval, :do_apply, 6, [file: 'erl_eval.erl', line: 680]}
42% {:elixir_module, :compile, 5, [file: 'src/elixir_module.erl', line: 107]}
42% {:elixir_module, :eval_form, 6, [file: 'src/elixir_module.erl', line: 333]}
31% {:elixir_compiler, :compile, 3, [file: 'src/elixir_compiler.erl', line: 58]}
31% {:elixir_erl_compiler, :spawn, 2, [file: 'src/elixir_erl_compiler.erl', line: 20]}
10% {:elixir_compiler, :compile, 3, [file: 'src/elixir_compiler.erl', line: 60]}
21% {:elixir_module, :compile, 5, [file: 'src/elixir_module.erl', line: 140]}
21% {:elixir_erl_compiler, :spawn, 2, [file: 'src/elixir_erl_compiler.erl', line: 20]}
7% {:elixir_module, :compile, 5, [file: 'src/elixir_module.erl', line: 142]}
7% {:code_server, :call, 1, [file: 'code_server.erl', line: 139]}
18% {Code, :verify_loaded, 1, [file: 'lib/code.ex', line: 1394]}
17% {Module.ParallelChecker, :collect_results, 2, [file: 'lib/module/parallel_checker.ex', line: 31]}
:ok
By default it takes 10000 samples, one every millisecond and then analyzes the stack traces. Since the sampling is time based it’s especially useful when reduction count based profiling leads you to a red herring.
Have fun!
Popular in Libraries
https://www.conduitframework.com/
The best overview for how things are tied together is this presentation. Modules and functions are pre...
New
Been making an MLElixir thing (not released yet…) for fun in spare time in the past day. I’m just trying to see how much I can get an ML...
New
I just released the first version of Temple: an HTML DSL for Elixir and Phoenix!
You can read this blog post or the docs for more info...
New
Expat is a tiny experiment I did for extracting patterns and being able to reuse them (compose and share patterns between elixir librarie...
New
What is ContEx?
A pure Elixir server-side data plotting/charting library outputting SVG.
It has nice barcharts in particular and works g...
New
Hey guyz
We at @aviabird are working on a payment library in elixir/phoenix. We are targeting March 2018 to add 56 Gateways to it.
Have...
New
ExARI
An Elixir library for interfacing with Asterisk using the ARI protocol.
Be sure to check out the example application https://git...
New
Elixir plugin for JetBrain’s IntelliJ Platform (including Rubymine)
This is a plugin that adds support for Elixir to JetBrains IntelliJ...
New
Hello everyone!
I want to share with you something that I’m really proud of: https://stillstatic.io/
Still is a static site builder for...
New
You may know https://ui.shadcn.com/, a UI component library for React. I really love it’s design style and components. I’ve built some co...
New
Other popular topics
I’m not a pro in using Regex and can’t figure out why the following behaviour happens, especially if we take into account the difference ...
New
TL;DR: I’ve just released an implementation of Microsoft’s IDE-independent Language Server Protocol for Elixir. It adds language support ...
New
Hello!
tl;dr Announcing Oban, an Ecto based job processing library with a focus on reliability and historical observability.
After spen...
New
In asking this question I am more interested about the expressiveness of the language itself and less concerned about the availability of...
New
This post is a wiki (feel free to hit the edit button near the bottom right of this post to add your own changes!)
This post collects co...
New
Hi, this is for people who, like me, have had some friction using .html.heex templates in VSCode.
The solution seems to be, in a hyphena...
New
None of the current solutions worked well for me, so I went ahead and built a user management system from scratch.
This project took far...
New
When I run the Plug and I recompile I wind up having to use Ctrl C to quit iex and start again. Witht the help of rlwrap I can use the cu...
New
Original source of discussion: This topic on the Pragmatic Programmers' Functional Web Development with Elixir, OTP, and Phoenix forum.
...
New
Hello again - after a longish gap I’ve decided I really must dig into Elixir and see what’s been happening here - so I have a few questio...
New







