Profiling

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 ...

Get Adopting Elixir now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.