time

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2026 License: Apache-2.0 Imports: 14 Imported by: 2 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package time implements the POSIX time utility, with the format string extensions of the GNU one.

The real time of the run is measured with the runtime clock around the execution of the utility. The user and system CPU times and the other resource counters come from the runtime execution-usage hook; the averaged memory sizes the hook does not carry, like the shared text and unshared data sizes, are always written as zero, as they are on the systems whose kernels do not fill them in.

When the runtime cannot report the usage counters, every resource specifier but the elapsed time degrades to zero, and the built-in default format degrades to the three POSIX lines of real, user and system time.

The percentage of the CPU is computed from the full durations the runtime carries, rather than from the millisecond-truncated ones of GNU time, so it keeps its precision on very short runs.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

New returns a new Prog.

Types

type Prog

type Prog struct {
	*coreutils.Runtime
}

Prog is the time core utility.

func (*Prog) Run

func (p *Prog) Run(ctx context.Context, args ...string) error

Run invokes the utility operand with the argument operands, and writes the timing statistics of the run to the standard error, or to the file the -o option names. The exit status of the utility becomes the exit status of time, and the 127, 126 and 125 statuses of a failed execution are passed along with a diagnostic, without statistics. The context error is returned as-is when the caller's context is done.

Jump to

Keyboard shortcuts

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