timer

package
v1.14.0-beta.2 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2019 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Phase

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

Phase represents a phase of a test. Phases can overlap.

func (*Phase) End

func (phase *Phase) End()

End marks the phase as ended, unless it had already been ended before.

type TestPhaseTimer

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

A TestPhaseTimer groups phases and provides a way to export their measurements as JSON or human-readable text. It is safe to use concurrently.

func NewTestPhaseTimer

func NewTestPhaseTimer() *TestPhaseTimer

NewTestPhaseTimer creates a new TestPhaseTimer.

func (*TestPhaseTimer) PrintHumanReadable

func (timer *TestPhaseTimer) PrintHumanReadable() string

PrintHumanReadable returns durations of all phases.

func (*TestPhaseTimer) PrintJSON

func (timer *TestPhaseTimer) PrintJSON() string

PrintJSON returns durations of all phases with JSON format.

func (*TestPhaseTimer) StartPhase

func (timer *TestPhaseTimer) StartPhase(sequenceNumber int, phaseName string) *Phase

StartPhase starts a new phase. sequenceNumber is an integer prepended to phaseName in the output, such that lexicographic sorting of phases in perfdash reconstructs the order of execution. Unfortunately it needs to be provided manually, since a simple incrementing counter would have the effect that inserting a new phase would renumber subsequent phases, breaking the continuity of historical records.

func (*TestPhaseTimer) SummaryKind

func (timer *TestPhaseTimer) SummaryKind() string

SummaryKind returns the summary of test summary.

Jump to

Keyboard shortcuts

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