simulation

package
v0.0.0-...-5110dc8 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2021 License: BSD-3-Clause Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Simulator

type Simulator interface {
	// RegisterStats offers the simulator an opportunity to
	// register any additional statistics before processing.
	RegisterStats(*Stats)

	// Process feeds another heap allocation trace event
	// into the simulator.
	Process(goat.Event, *Stats)
}

Simulator describes a heap allocation simulator for Go.

type Stats

type Stats struct {
	// Timestamp is the time in CPU ticks for the most
	// recent event processed by the simulator.
	Timestamp uint64

	// GCCycles is the number of complete GC cycles that
	// have passed since the simulator started.
	GCCycles uint64

	// Allocs is the total number of allocations processed by
	// the simulator.
	Allocs uint64

	// Frees is the total number of frees processed by the
	// simulator.
	Frees uint64

	// ObjectBytes is the amount of memory in bytes
	// occupied by live objects.
	ObjectBytes uint64

	// StackBytes is the amount of memory in bytes
	// occupied by live stacks.
	StackBytes uint64

	// UnusedBytes is the amount of memory in bytes
	// which is not occupied by live memory, but
	// that otherwise cannot be used to do so (e.g. fragmentation).
	UnusedBytes uint64

	// FreeBytes is the amount of memory in bytes
	// which is not occupied by live memory, but that may
	// be used to do so in the future.
	FreeBytes uint64
	// contains filtered or unexported fields
}

Stats is a sample of statistics produced by the simulator.

func NewStats

func NewStats() *Stats

NewStats creates a new valid Stats object.

Must be used instead of constructing a Stats object directly, since there are unexported fields which may need to be initialized.

func (*Stats) AddOther

func (s *Stats) AddOther(name string, amount uint64)

AddOther adds an amount to the value to a implementation-specific statistic. Panics if the statistic has not been registered.

func (*Stats) GetOther

func (s *Stats) GetOther(name string) uint64

GetOther returns the value for a implementation-specific statistic by name. Returns 0 if the statistic is not registered.

func (*Stats) OtherStats

func (s *Stats) OtherStats() []string

OtherStats returns a list of registered implementation-specific statistics.

func (*Stats) RegisterOther

func (s *Stats) RegisterOther(name string)

RegisterOther registers a new implementation-specific statistic.

This operation is idempotent and safe to perform again, even after a statistic has been modified.

func (*Stats) SubOther

func (s *Stats) SubOther(name string, amount uint64)

SubOther subtracts an amount from the value of a implementation-specific statistic. Panics if the statistic has not been registered.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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