Phase represents a phase of a test. Phases can overlap.
type Phase struct {
// contains filtered or unexported fields
}
func (phase *Phase) End()
End marks the phase as ended, unless it had already been ended before.
A TestPhaseTimer groups phases and provides a way to export their measurements as JSON or human-readable text. It is safe to use concurrently.
type TestPhaseTimer struct {
// contains filtered or unexported fields
}
func NewTestPhaseTimer() *TestPhaseTimer
NewTestPhaseTimer creates a new TestPhaseTimer.
func (timer *TestPhaseTimer) PrintHumanReadable() string
PrintHumanReadable returns durations of all phases.
func (timer *TestPhaseTimer) PrintJSON() string
PrintJSON returns durations of all phases with JSON format.
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 (timer *TestPhaseTimer) SummaryKind() string
SummaryKind returns the summary of test summary.