units

package
v0.0.0-...-1327151 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2020 License: BSD-3-Clause Imports: 1 Imported by: 0

Documentation

Overview

Package units implements human-friendly representations of common units.

Index

Constants

View Source
const (
	Runtime        = "ns/op"
	DataRate       = "MB/s"
	BytesAllocated = "B/op"
	Allocs         = "allocs/op"
)

Standard library testing package units.

Variables

This section is empty.

Functions

This section is empty.

Types

type Quantity

type Quantity struct {
	Value float64
	Unit  string
}

Quantity is a value in some unit.

func BytesBinary

func BytesBinary(b float64) Quantity

BytesBinary represents the given number of bytes with binary prefixes (multiples of 1024).

func BytesSI

func BytesSI(b float64) Quantity

BytesSI represents the given number of bytes with SI units (multiples of 1000).

func Duration

func Duration(ns float64) Quantity

Duration represents a nanosecond quantity in time units up to hours.

func Frequency

func Frequency(f float64) Quantity

Frequency represents a frequency in Hertz.

func Humanize

func Humanize(q Quantity) Quantity

Humanize attempts to represent q in a more friendly unit for human consumption.

Jump to

Keyboard shortcuts

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