View Source Credo.Execution.ExecutionTiming (Credo v1.6.7)

The ExecutionTiming module can help in timing the execution of code parts and storing those timing inside the Credo.Execution struct.

Link to this section Summary

Functions

Returns all timings for the given exec.

Adds a timing piped from run/2 to the given exec (using the given values of tags, started_at and duration).

Adds a timing to the given exec using the given values of tags, started_at and duration.

Returns all timings for the given exec and tag_name.

Returns all timings for the given exec and tag_name where the tag's value also matches the given regex.

Returns a specification to start this module under a supervisor.

Returns the latest timestamp plus its duration for the given exec.

Groups all timings for the given exec and tag_name.

Runs the given fun and prints the time it took with the given label.

Returns the current timestamp in the same format (microseconds) as the returned starting times of run/1.

Runs the given fun and returns a tuple of {started_at, duration, result}.

Same as run/1 but takes fun and args separately.

Returns the earliest timestamp for the given exec.

Link to this section Functions

Returns all timings for the given exec.

Link to this function

append(arg, execution, tags)

View Source

Adds a timing piped from run/2 to the given exec (using the given values of tags, started_at and duration).

Link to this function

append(execution, tags, started_at, duration)

View Source

Adds a timing to the given exec using the given values of tags, started_at and duration.

Returns all timings for the given exec and tag_name.

Link to this function

by_tag(exec, tag_name, regex)

View Source

Returns all timings for the given exec and tag_name where the tag's value also matches the given regex.

Returns a specification to start this module under a supervisor.

See Supervisor.

Returns the latest timestamp plus its duration for the given exec.

Link to this function

grouped_by_tag(exec, tag_name)

View Source

Groups all timings for the given exec and tag_name.

Runs the given fun and prints the time it took with the given label.

iex> Credo.Execution.ExecutionTiming.inspect("foo", fn -> some_complicated_stuff() end)
foo: 51284

Returns the current timestamp in the same format (microseconds) as the returned starting times of run/1.

Runs the given fun and returns a tuple of {started_at, duration, result}.

iex> Credo.Execution.ExecutionTiming.run(fn -> some_complicated_stuff() end)
{1540540119448181, 51284, [:whatever, :fun, :returned]}

Same as run/1 but takes fun and args separately.

Returns the earliest timestamp for the given exec.