memory

package
v0.12.1 Latest Latest
Warning

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

Go to latest
Published: May 28, 2019 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatBytes

func FormatBytes(bytes int64) string

FormatBytes converts number of bytes to appropriately sized string

func ParseString

func ParseString(s string) (int64, error)

ParseString converts string to number of bytes

Types

type Size

type Size int64

Size implements flag.Value for collecting memory size in bytes

const (
	B Size = 1 << (10 * iota)
	KiB
	MiB
	GiB
	TiB
	PiB
	EiB

	KB Size = 1e3
	MB Size = 1e6
	GB Size = 1e9
	TB Size = 1e12
	PB Size = 1e15
	EB Size = 1e18
)

base 2 and base 10 sizes

func (Size) Base10String

func (size Size) Base10String() string

Base10String converts size to a string using base-10 prefixes

func (Size) Base2String

func (size Size) Base2String() string

Base2String converts size to a string using base-2 prefixes

func (Size) EB

func (size Size) EB() float64

EB returns size in exabytes

func (Size) EiB

func (size Size) EiB() float64

EiB returns size in exbibytes

func (Size) Float64

func (size Size) Float64() float64

Float64 returns bytes size as float64

func (Size) GB

func (size Size) GB() float64

GB returns size in gigabytes

func (Size) GiB

func (size Size) GiB() float64

GiB returns size in gibibytes

func (Size) Int

func (size Size) Int() int

Int returns bytes size as int

func (Size) Int32

func (size Size) Int32() int32

Int32 returns bytes size as int32

func (Size) Int64

func (size Size) Int64() int64

Int64 returns bytes size as int64

func (Size) KB

func (size Size) KB() float64

KB returns size in kilobytes

func (Size) KiB

func (size Size) KiB() float64

KiB returns size in kibibytes

func (Size) MB

func (size Size) MB() float64

MB returns size in megabytes

func (Size) MiB

func (size Size) MiB() float64

MiB returns size in mebibytes

func (Size) PB

func (size Size) PB() float64

PB returns size in petabytes

func (Size) PiB

func (size Size) PiB() float64

PiB returns size in pebibytes

func (*Size) Set

func (size *Size) Set(s string) error

Set updates value from string

func (Size) String

func (size Size) String() string

String converts size to a string using base-2 prefixes, unless the number appears to be in base 10.

func (Size) TB

func (size Size) TB() float64

TB returns size in terabytes

func (Size) TiB

func (size Size) TiB() float64

TiB returns size in tebibytes

func (Size) Type

func (Size) Type() string

Type implements pflag.Value

type Sizes

type Sizes struct {
	Default []Size
	Custom  []Size
}

Sizes implements flag.Value for collecting memory size

func (*Sizes) Set

func (sizes *Sizes) Set(s string) error

Set adds values from byte values

func (Sizes) Sizes

func (sizes Sizes) Sizes() []Size

Sizes returns the loaded values

func (Sizes) String

func (sizes Sizes) String() string

String converts values to a string

Jump to

Keyboard shortcuts

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