timer

package
v0.83.0 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2026 License: BSD-3-Clause Imports: 2 Imported by: 0

Documentation

Overview

Package timer provides a simple timer for measuring the duration of code execution.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Duration

func Duration(label string, t time.Time)

Example usage: `defer timer.Duration("some label", time.Now())`

Types

type Timer

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

Timer is a simple timer for measuring the duration of code execution.

func Conditional

func Conditional(condition bool) *Timer

Conditional returns a new timer that is only active if the condition is true.

func New

func New() *Timer

New returns a new timer.

func (*Timer) Checkpoint

func (t *Timer) Checkpoint(label string)

Checkpoint prints the duration since the last checkpoint and resets the timer.

func (*Timer) Reset

func (t *Timer) Reset()

Reset resets the timer.

Jump to

Keyboard shortcuts

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