timing

package
v0.21.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 23, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package timing emits phase-level elapsed-time lines when the global output sink has verbose mode enabled. Each call site looks like:

done := timing.Phase("ghcr-token")
defer done()

With verbose off (or no output configured) calls are cheap no-ops. Output is one line per phase:

[timing] <label> elapsed=<duration>

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Phase

func Phase(label string) func()

Phase starts a timer and returns a stop closure. Calling the closure emits one verbose line with elapsed time. Subsequent calls are no-ops, so callers can defer freely without worrying about double-emit.

func SetOutput

func SetOutput(o *output.Output)

SetOutput wires the package to an Output sink. Pass nil to disable. Subsystems already use this pattern (build.SetOutput, download.SetProgressEnabled); timing follows it so that cmd/gale/output_mode.go can configure all subsystems together.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL