dominicletz

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://github.com/dominicletz/profiler

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!

Where Next?

Popular in Announcing Top

mischov
import Meeseeks.CSS html = HTTPoison.get!("https://news.ycombinator.com/").body for story &lt;- Meeseeks.all(html, css("tr.athing")) do...
New
kelvinst
Hey everyone! Well, we made this lib a while ago and now we decided to finally go out and public with it! It’s a tool for creating and m...
New
Crowdhailer
Raxx is an alternative to Plug and is inspired by projects such as Rack(Ruby) and Ring(Clojure). 1.0-rc.1 is now available. To use it re...
New
tmbb
PhoenixWS - Websockets over Phoenix Channels Source code on Github here: GitHub - tmbb/phoenix_ws: Websockets implemented over Phoenix Ch...
New
wojtekmach
Hey everyone! Req is an HTTP client for Elixir that I’ve been working on for quite some time. There is already a lot of HTTP clients out...
New
zoltanszogyenyi
Hey everyone :waving_hand: Excited to join this forum - I am one of the founders and current project maintainers of a popular and open-s...
New
martinthenth
Hello everybody :wave: Recently, some of my colleagues talked about database ids and uuids and their problems, and I remembered the pain...
New

Other popular topics Top

vertexbuffer
Hello, can anybody help here..? I have a list of players and I what to delete an element, but every for loop the list is reverting to ori...
New
baxterw3b
Hi guys, i’m new in the Elixir world, and i have to say, that i love it! i’m having some problem to understand anonymous functions with ...
New
aadeshere1
I have a another noob question about loop. Since elixir is immutable, while loop is not directly possible. total = 10 while total != 0 ...
New
greenz1
I have a phoenix application from which a user can download multiple(5-6) files of size 1MB. I couldn’t find anything related to sending ...
New
alice
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
JorisKok
I have a server on AWS, and was running a load test using artillery. When looking at the Phoenix dashboard I see the Ports going to 100% ...
New

We're in Beta

About us Mission Statement