Profiling is a performance tuning technique that measures primarily the frequency and duration of function calls. Erlang/OTP ships with three profilers. cprof counts the number of invocations, eprof measures execution time, and fprof measures both frequency and time. Each has its own advantages and disadvantages. cprof runs quite fast and has a minimal impact on execution times, but doesn’t tell you as much as full execution times. On the other hand, fprof provides much more data, but expect it to impact your execution time.
Elixir provides integration with cprof, eprof, and fprof via the Mix tool. In this section, we’ll provide a quick example of using cprof and fprof.
Imagine that your load tests found one fairly slow route. After ...