View Source FunctionTimer (inr_word v0.1.0)
Provides two functions timed_fun/2
and timed_fun/3
to time any passed function. Function:
- can be passed as captured using
timed_fun/2
- can be passed as Module, Function using
timed_fun/3
Link to this section Summary
Link to this section Functions
# To pass a captured function
iex(1)> FunctionTimer.timed_fun(&InrWord.inr_word/1, 97) |> elem(1) == %{no: "₹ 97", words: "₹ Ninety-seven"}
@spec timed_fun(function(), any(), any()) :: {integer(), any()}
@spec timed_fun(Module, function(), any()) :: {integer(), any()}
# To pass a Module, Function
iex(4)> FunctionTimer.timed_fun(InrWord, :inr_word, [97]) |> elem(1)
%{no: "₹ 97", words: "₹ Ninety-seven"}