Skip to Main Content
Mastering Elixir
book

Mastering Elixir

by André Albuquerque, Daniel Caixinha
July 2018
Intermediate to advanced content levelIntermediate to advanced
574 pages
14h 7m
English
Packt Publishing
Content preview from Mastering Elixir

Profiling with the fprof profiler

We're now going to learn how to use one of the profilers that ships with Mix to analyze the performance of a certain function in our application. The profiler we're going to use is based on Erlang's fprof profiler. Mix exposes this profiler through a Mix task, which is how we're going to interact with it.

We're going to profile the ElixirDrip.Storage.store/4 function, which is responsible for creating a new Media entry on the database and triggering an upload task. To simulate that this function is taking way longer than expected to complete, we're going to insert a Process.sleep/1 call into the ElixirDrip.Storage.Media.create_initial_changeset function, which is one of the functions called by the store

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Testing Elixir

Testing Elixir

Andrea Leopardi, Jeffrey Matthias

Publisher Resources

ISBN: 9781788472678Supplemental Content