profiling

package
v0.26.0 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2023 License: GPL-3.0, GPL-3.0 Imports: 0 Imported by: 0

Documentation

Overview

Package profiling provides statistics typs for helping to record the amount of load a source function, line, etc. has over a period of one frame. It also keeps track of the average load and maximum load over an extended period of time.

In addition, package profiling defines a Focus type and values. Useful in helping to understand when a function or line of code (for example) has executed.

Index

Constants

This section is empty.

Variables

View Source
var FocusOptions = []string{"All", "VBLANK", "Screen", "Overscan"}

List of Focus values as strings

Functions

This section is empty.

Types

type Focus

type Focus int

Focus values are used to indicate when (very broadly) a function, a line of code, etc. has executed

const (
	FocusAll      Focus = 0x00
	FocusScreen   Focus = 0x01
	FocusVBLANK   Focus = 0x02
	FocusOverscan Focus = 0x04
)

List of Focus values

func (Focus) String

func (k Focus) String() string

type Load

type Load struct {
	// cycle count
	FrameCount   float32
	AverageCount float32
	MaxCount     float32

	// cycle count expressed as a percentage
	Frame   float32
	Average float32
	Max     float32

	// whether the corresponding values are valid
	FrameValid   bool
	AverageValid bool
	MaxValid     bool
}

Load records the frame (or current) load as well as the average and maximum load.

type Stats

type Stats struct {
	OverProgram  Load
	OverFunction Load

	// cycle count this frame
	Count float32
	// contains filtered or unexported fields
}

Stats records the cycle count over time and can be used to the frame (or current) load as well as average and maximum load.

The actual percentage values are accessed through the OverProgram and OverFunction fields. These fields provide the necessary scale by which the load is measured.

The validity of the OverProgram and OverFunction fields depends on context. For instance, for the SourceFunction type, the corresponding OverFunction field is invalid. For the Source type meanwhile, neither field is valid.

For the SourceLine type however, both OverProgram and OverFunction can be used to provide a different scaling to the load values.

func (*Stats) HasExecuted

func (stats *Stats) HasExecuted() bool

HasExecuted returns true if the statistics have ever been updated. ie. the source associated with this statistic has ever executed.

Not to be confused with the FrameValid, AverageValid and MaxValid fields of the Load type.

func (*Stats) NewFrame

func (stats *Stats) NewFrame(prog *Stats, function *Stats)

NewFrame update statistics, using source and function to update the Load values as appropriate.

func (*Stats) Reset

func (stats *Stats) Reset()

Reset the statisics

type StatsGroup

type StatsGroup struct {
	// cycle statistics for the entire program
	Overall Stats

	// kernel specific cycle statistics for the program. accumulated only once TV is stable
	VBLANK   Stats
	Screen   Stats
	Overscan Stats
}

StatsGroup collates the Stats instance for all kernel views of the program.

Jump to

Keyboard shortcuts

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