lap

Types

pub opaque type DurationData
pub opaque type LapData

Functions

pub fn pretty_print(data: LapData) -> String

Returns a table of the durations as a string. The table includes the start and end markers, duration, and percentage of the total time.

pub fn sort_max(data: LapData) -> LapData

Sorts the durations in descending order. This is useful for identifying the slowest parts of your timed code.

pub fn start(marker: String, duration_unit: Unit) -> LapData

Begins a new timing session with the given marker and duration unit. The duration_unit is a birl Unit.

pub fn start_in_microseconds(marker: String) -> LapData

Begins a new timing session with the given marker and duration unit in microseconds.

pub fn start_in_milliseconds(marker: String) -> LapData

Begins a new timing session with the given marker and duration unit in milliseconds.

pub fn start_in_minutes(marker: String) -> LapData

Begins a new timing session with the given marker and duration unit in minutes.

pub fn start_in_seconds(marker: String) -> LapData

Begins a new timing session with the given marker and duration unit in seconds.

pub fn time(data: LapData, marker: String) -> LapData

Marks the end of the current lap with the given marker.

pub fn to_list(data: LapData) -> List(#(String, String, Int))

Return the durations as a list of tuples. Each tuple contains:

  1. The start marker (String)
  2. The end marker (String)
  3. The duration (Int) in the specified time unit
pub fn total_time(data: LapData) -> Int

Returns the total time elapsed from the first marker to the last marker, in the duration unit specified via one of the start functions.

Search Document