Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( NoString = "" NoStack = []trace.StackFrame{} )
Functions ¶
Types ¶
type Batch ¶
type Batch struct {
// contains filtered or unexported fields
}
Batch represents an event batch.
type Generation ¶
type Generation struct {
// contains filtered or unexported fields
}
Generation represents a single generation in the trace.
func (*Generation) Batch ¶
func (g *Generation) Batch(thread trace.ThreadID, time Time) *Batch
Batch starts a new event batch in the trace data.
This is convenience function for generating correct batches.
func (*Generation) Stack ¶
func (g *Generation) Stack(stk []trace.StackFrame) uint64
Stack registers a stack with the trace.
This is a convenience function for easily adding correct stacks to traces.
func (*Generation) String ¶
func (g *Generation) String(s string) uint64
String registers a string with the trace.
This is a convenience function for easily adding correct strings to traces.
type Time ¶
type Time uint64
Time represents a low-level trace timestamp (which does not necessarily correspond to nanoseconds, like trace.Time does).
type Trace ¶
type Trace struct {
// contains filtered or unexported fields
}
Trace represents an execution trace for testing.
It does a little bit of work to ensure that the produced trace is valid, just for convenience. It mainly tracks batches and batch sizes (so they're trivially correct), tracks strings and stacks, and makes sure emitted string and stack batches are valid. That last part can be controlled by a few options.
Otherwise, it performs no validation on the trace at all.
func (*Trace) DisableTimestamps ¶
func (t *Trace) DisableTimestamps()
DisableTimestamps makes the timestamps for all events generated after this call zero. Raw events are exempted from this because the caller has to pass their own timestamp into those events anyway.
func (*Trace) ExpectFailure ¶
ExpectFailure writes down that the trace should be broken. The caller must provide a pattern matching the expected error produced by the parser.
func (*Trace) ExpectSuccess ¶
func (t *Trace) ExpectSuccess()
ExpectSuccess writes down that the trace should successfully parse.
func (*Trace) Generation ¶
func (t *Trace) Generation(gen uint64) *Generation
Generation creates a new trace generation.
This provides more structure than Event to allow for more easily creating complex traces that are mostly or completely correct.