timing

package
v0.3.20 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2021 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Opt

type Opt func(profiling *timeProfiling)

Opt is a type for implementing functional options pattern

func WithMsgFormat

func WithMsgFormat(msgTemplate string) Opt

WithMsgFormat specify a msg-format string such as "xxx takes %v"

func WithWriter

func WithWriter(w Writer) Opt

WithWriter specify a msg printer/formmater

type P

type P interface {
	WithWriter(writer Writer) P
	WithoutWriter() P
	Duration() time.Duration
}

P is a timing tool interface type

func New

func New(opts ...Opt) P

New returns a timing tool for calculating the elapsed time in time.Duration

type Writer

type Writer func(msg string, args ...interface{})

Writer is a formatter and printer such as log.Printf, t.Logf, ...

Jump to

Keyboard shortcuts

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