This section is empty.


This section is empty.


This section is empty.


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.

Source Files