timing

package
v1.25.12 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2026 License: Apache-2.0 Imports: 5 Imported by: 1 module, 0 packages

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

Index

Constants

This section is empty.

Variables

View Source
var DefaultFormat = template.Must(template.New("").Parse("{{range $c, $t := .}}{{$c}}: {{$t}}\n{{end}}"))

DefaultFormat is a default format string used by Summary.

View Source
var DefaultRun = NewTimedRun()

DefaultRun is the default "singleton" TimedRun instance.

Functions

func JSON added in v0.8.0

func JSON() (string, error)

func Summary

func Summary() string

Summary outputs a summary of the DefaultTimedRun.

Types

type TimedRun

type TimedRun struct {
	// contains filtered or unexported fields
}

TimedRun provides a running store of how long is spent in each category.

func NewTimedRun

func NewTimedRun() *TimedRun

NewTimedRun returns an initialized TimedRun instance.

func (*TimedRun) JSON added in v0.8.0

func (tr *TimedRun) JSON() (string, error)

func (*TimedRun) Stop

func (tr *TimedRun) Stop(t *Timer)

Stop stops the specified timer and increments the time spent in that category.

func (*TimedRun) Summary

func (tr *TimedRun) Summary() string

Summary outputs a summary of the specified TimedRun.

type Timer

type Timer struct {
	// contains filtered or unexported fields
}

Timer represents a running timer.

func Start

func Start(category string) *Timer

Start starts a new Timer and returns it.

Jump to

Keyboard shortcuts

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