cover

package
v0.0.0-...-0332a73 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

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.

func (*Block) Clone

func (s *Block) Clone() *Block

Clone the snapshot

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

func (c *Coverage) ProfileText() string

ProfileText generates output in the form of cover profile output file.

func (*Coverage) WriteProfile

func (c *Coverage) WriteProfile(w io.Writer) error

WriteProfile generates output in the form of cover profile output file and writes to the given writer.

type ReadCountFn

type ReadCountFn func([]uint32)

ReadCountFn is used to read Count field of coverage var

type ReadPosFn

type ReadPosFn func([]uint32)

ReadPosFn is used to read Pos 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

func (r *Registry) GetCoverage() *Coverage

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

func (*Registry) Snapshot

func (r *Registry) Snapshot()

Snapshot the coverage data from registered coverage data structures

Directories

Path Synopsis
Code generated for package assets by go-bindata DO NOT EDIT.
Code generated for package assets by go-bindata DO NOT EDIT.

Jump to

Keyboard shortcuts

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