units

package
v0.0.0-...-99f2fd5 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2019 License: Apache-2.0 Imports: 0 Imported by: 145

Documentation

Overview

Package units contains the various units of measurement for a metric.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FromSeconds

func FromSeconds(u Unit) float64

Returns the conversion factor between seconds and u. For example FromSeconds(Millisecond) returns 1000. Returns 1.0 if u is not a time unit.

func FromSecondsRational

func FromSecondsRational(u Unit) (numerator, denominator int64)

FromSecondsRational is the same as FromSeconds but returns answer as a rational number.

Types

type Unit

type Unit string

Unit represents a unit of measurement

const (
	Unknown       Unit = ""
	None          Unit = "None"
	Millisecond   Unit = "Milliseconds"
	Second        Unit = "Seconds"
	Celsius       Unit = "Celsius"
	Byte          Unit = "Bytes"
	BytePerSecond Unit = "BytesPerSecond"
)

func (Unit) String

func (u Unit) String() string

Jump to

Keyboard shortcuts

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