timing

package
v1.9.2 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2023 License: Apache-2.0 Imports: 5 Imported by: 10

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