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