Documentation ¶
Overview ¶
Package cover contains glue infrastructure code for collecting and serving live code-coverage data from a process. The package gets pulled-in implicitly from an instrumented binary and registers a topic in Ctrlz that allows snapshotting, clearing of code coverage state, as well as the ability to download a coverage profile file.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Block ¶
type Block struct { Name string `json:"name"` Count []uint32 `json:"count"` Pos []uint32 `json:"pos"` NumStmt []uint16 `json:"num_stmt"` }
Block is code coverage snapshot for a particular file block.
type ClearCountFn ¶
type ClearCountFn func()
ClearCountFn is used to clear the Count field of coverage var
type Coverage ¶
type Coverage struct {
Blocks []*Block `json:"blocks"`
}
Coverage data
func (*Coverage) ProfileText ¶
ProfileText generates output in the form of cover profile output file.
type ReadCountFn ¶
type ReadCountFn func([]uint32)
ReadCountFn is used to read Count field of coverage var
type ReadStmtFn ¶
type ReadStmtFn func([]uint16)
ReadStmtFn is used to read Stmt field of coverage var
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry for code coverage blocks
func GetRegistry ¶
func GetRegistry() *Registry
GetRegistry returns the singleton code coverage block registry.
func (*Registry) Clear ¶
func (r *Registry) Clear()
Clear the coverage data from registered coverage data structures
func (*Registry) GetCoverage ¶
GetCoverage collects Read from all registered blocks.
func (*Registry) Register ¶
func (r *Registry) Register( length int, context string, readPosFn ReadPosFn, readStmtFn ReadStmtFn, readCountFn ReadCountFn, clearCountFn ClearCountFn, )
Register code coverage data structure