metrics

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2026 License: MIT Imports: 6 Imported by: 2 modules, 1 package

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 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

View Source
var (
	ErrCannotWriteStringFile = errors.New("cannot write string to file")
	ErrCannotCreateFile      = errors.New("cannot create file")
)

Errors reported when a metrics report cannot be written out.

Functions

This section is empty.

Types

type RenderIssue

type RenderIssue struct {
	Operation string
	Message   string
	Error     string
}

RenderIssue describes a best-effort render fallback that did not abort PDF generation.

func (RenderIssue) String

func (i RenderIssue) String() string

String returns the render issue formatted.

type Report

type Report struct {
	TimeMetrics []TimeMetric
	SizeMetric  SizeMetric
	// GenerationMode is the mode the document was actually generated with,
	// which is not always the mode that was configured: a document using a
	// feature the configured mode cannot reproduce falls back to sequential
	// generation. Empty when the document did not come from a generator that
	// records it (a merge result, for example).
	GenerationMode consts.GenerationMode
	RenderIssues   []RenderIssue
}

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