Skip to content

Timing

🛠️ Tools · ⬅ Home


Millisecond timing support when the underlying operating system supports it.

Usage

timing command [ --help ] [ --name ]

Time command, similar to time but uses internal functions Outputs time as timingReport

Arguments

  • command - Executable. Required. Command to run.
  • --help - Flag. Optional. Display this help.
  • --name - String. Optional. Display this help.

Return codes

  • 0 - Success
  • 1 - Environment error
  • 2 - Argument error

Usage

timingElapsed timingOffset [ --help ]

Show elapsed time from a start time

Arguments

  • timingOffset - UnsignedInteger. Required. Offset in milliseconds from January 1, 1970.
  • --help - Flag. Optional. Display this help.

Examples

init=$(timingStart)
...
timingElapsed "$init"

Return codes

  • 0 - Success
  • 1 - Environment error
  • 2 - Argument error

Requires

__timestamp returnEnvironment validate date

Usage

timingStart [ --help ]

Outputs the offset in milliseconds from January 1, 1970. Should never fail, unless date is not installed

Arguments

  • --help - Flag. Optional. Display this help.

Examples

init=$(timingStart)
...
timingReport "$init" "Completed in"

Return codes

  • 0 - Success
  • 1 - Environment error
  • 2 - Argument error

Requires

__timestamp, returnEnvironment date

Usage

timingFormat [ --help ] [ delta ]

Format a timing output (milliseconds) as seconds using a decimal

Arguments

  • --help - Flag. Optional. Display this help.
  • delta - Integer. Milliseconds

Return codes

  • 0 - Success
  • 1 - Environment error
  • 2 - Argument error

Usage

timingReport [ --color color ] [ --help ] [ --handler handler ] [ start ] [ message ]

Outputs the timing optionally prefixed by a message. Outputs a nice colorful message showing the number of seconds elapsed as well as your custom message.

Arguments

  • --color color - Make text this color (default is green)
  • --help - Flag. Optional. Display this help.
  • --handler handler - Function. Optional. Use this error handler instead of the default error handler.
  • start - Unix timestamp milliseconds. See timingStart.
  • message - Any additional arguments are output before the elapsed value computed

Examples

init=$(timingStart)
...
timingReport "$init" "Deploy completed in"

Return codes

  • 0 - Exits with exit code zero