testutils

package
v0.0.0-...-c676e8e Latest Latest
Warning

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

Go to latest
Published: Jan 1, 2025 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PrintSingleCall

func PrintSingleCall(startTime time.Time)

PrintSingleCall prints the time taken for a single call It should be used in a defer statement, like: defer PrintSingleCall(Start())

func Start

func Start() time.Time

Start returns the current time. It is a hlper function, used to single line measurements

func TimeSingleCall

func TimeSingleCall(startTime time.Time) time.Duration

TimeSingleCall returns the time taken for a single call It should be used in a defer statement, like: defer TimeSingleCall(Start())

Types

type TimeRepeatedCalls

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

TimeRepeatedCalls is a struct that stores the time taken for each call

func (TimeRepeatedCalls) Average

func (t TimeRepeatedCalls) Average() time.Duration

Average returns the average time taken for each call

func (*TimeRepeatedCalls) Call

func (t *TimeRepeatedCalls) Call(startTime time.Time)

Call stores the time taken for a single call It should be used in a defer statement, like: defer t.Call(Start())

func (TimeRepeatedCalls) Max

Max returns the maximum time taken for a call

func (TimeRepeatedCalls) Min

Min returns the minimum time taken for a call

func (TimeRepeatedCalls) PrintStats

func (t TimeRepeatedCalls) PrintStats()

PrintStats prints the average, max, min and sum time taken for each call

func (TimeRepeatedCalls) Sum

Sum returns the sum of all the time taken for each call

Jump to

Keyboard shortcuts

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