metrics

package
v2.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package metrics contains metrics models, constants and formatting.

Index

Constants

View Source
const (
	// Nano is the time scale in nanoseconds.
	Nano TimeScale = "ns"
	// Micro is the time scale in microseconds.
	Micro TimeScale = "μs"
	// Milli is the time scale in milliseconds.
	Milli TimeScale = "ms"
	// Byte is the size scale in bytes.
	Byte SizeScale = "b"
	// KiloByte is the size scale in kilobytes.
	KiloByte SizeScale = "Kb"
	// MegaByte is the size scale in megabytes.
	MegaByte SizeScale = "Mb"
	// GigaByte is the size scale in gigabytes.
	GigaByte SizeScale = "Gb"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Report

type Report struct {
	TimeMetrics []TimeMetric
	SizeMetric  SizeMetric
}

Report is a metrics report.

func (*Report) Normalize

func (r *Report) Normalize() *Report

Normalize normalizes the report.

func (*Report) Save

func (r *Report) Save(file string) error

Save saves the report in a file.

func (*Report) String

func (r *Report) String() string

String returns the report formatted.

type Size

type Size struct {
	Value float64
	Scale SizeScale
}

Size scales.

func (*Size) Normalize

func (t *Size) Normalize() bool

Normalize normalizes the size scale.

func (*Size) String

func (t *Size) String() string

String returns the size formatted.

type SizeMetric

type SizeMetric struct {
	Key  string
	Size Size
}

SizeMetric is a size metric.

func (*SizeMetric) Normalize

func (s *SizeMetric) Normalize()

Normalize normalizes the size metric.

func (*SizeMetric) String

func (s *SizeMetric) String() string

String returns the size metric formatted.

type SizeScale

type SizeScale string

SizeScale is the size scale.

type Time

type Time struct {
	Value float64
	Scale TimeScale
}

Time scales.

func (*Time) Normalize

func (t *Time) Normalize() bool

Normalize normalizes the time scale.

func (*Time) String

func (t *Time) String() string

String returns the time formatted.

type TimeMetric

type TimeMetric struct {
	Key   string
	Times []*Time
	Avg   *Time
}

TimeMetric is a time metric.

func (*TimeMetric) Normalize

func (m *TimeMetric) Normalize()

Normalize normalizes the time metric.

func (*TimeMetric) String

func (m *TimeMetric) String() string

String returns the time metric formatted.

type TimeScale

type TimeScale string

TimeScale is the time scale.

Jump to

Keyboard shortcuts

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