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
Image is an image processing library for Elixir. It is based upon the fabulous vix library that provides a libvips wrapper for Elixir.
I...
New
Introducing assertions, the library that helps you write really great test assertions!
GitHub: https://github.com/devonestes/assertions ...
New
Hello :wave:
Allow me to introduce you to Tz, an alternative time zone database support to Tzdata.
Why another library?
First and fore...
New
FastRSS
Parse RSS feeds very quickly:
This is rust NIF built using rustler
Uses the RSS rust crate to do the actual RSS parsing
Speed...
New
EDIT: since Ecto 3.0 final version is out, this post was amended to use the final versions in the instructions below.
Hi everyone,
We a...
New
If you would like to migrate away from node/npm/webpack while still using sass, the dart_sass package provides a installer and runner for...
New
I’ve cleaned up and open sourced three financial libraries I was using for my company. They are bindings for the APIs of these three comp...
New
Hi! Today, after a couple weeks of development I’ve released v0.1 of LiveVue.
It’s a seamless integration of Vue and Phoenix LiveView, i...
New
As the title states, EctoEnum has just been updated after some time of hardly any activity in the repo. Here’s the latest release: https:...
New
Let’s write a database! Well not really, but I think it’s a little sad that there doesn’t seem to be a simple in-memory distributed KV da...
New
Other popular topics
Okay, I'm having a heck of a time trying to figure out how to best handle the validation of belongs_to associations in Ecto. I'm sure I'...
New
In asking this question I am more interested about the expressiveness of the language itself and less concerned about the availability of...
New
What is the idiomatic way of matching for not nil in Elixir?
E.g.,
First way:
defp halt_if_not_signed_in(conn, signed_in_account) when...
New
As the title describes, I’m trying to run Enum.map() over a list of key/value pairs, where the value is a map. My data looks like this:
...
New
I’m working on defining a simple Ecto schema for a table (in PostGres), but I don’t see where I can define a column as NOT NULL. Conside...
New
What is the difference between System.get_env and Application.get_env? For example, what are best practices to use one versus another.
New
I am using Ecto timestamps with postgres, I can see the timestamps() use the :naive_dateime but for my use case I wanted to store the ti...
New
Hey,
Just curious what are the main benefits of Elixir compared to Clojure?
When is Elixir more useful than Clojure and vice versa?
Th...
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
Hello guys,
I have finally made it. I created an admin interface for a framework. It’s been on my todo list for years and with the curre...
New








