profiling

package
v0.30.0 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2024 License: GPL-3.0 Imports: 0 Imported by: 0

Documentation

Overview

Package profiling defines the types that are used to profile the performance of the coporocessor program. Principally, cycles consumed by a function, a line of source code or the program as a whole.

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 Calls added in v0.30.0

type Calls struct {
	Overall  CallsScope
	VBLANK   CallsScope
	Screen   CallsScope
	Overscan CallsScope
}

Calls measures the number of times a function has been called in each VCS scope. It only makes sense for this type to be used in the context of functions

func (*Calls) Call added in v0.30.0

func (cl *Calls) Call(focus Focus)

Call registers a new instance of the function being called

func (*Calls) Check added in v0.30.0

func (cl *Calls) Check(focus Focus)

Check is like call except that it only makes sure that the call figure is at least one. It's useful to make sure a function has been called at least once if it is part of the call stack

func (*Calls) NewFrame added in v0.30.0

func (cl *Calls) NewFrame(rewinding bool)

NewFrame commits accumulated data for the frame. The rewinding flag indicates that the emulation is in the rewinding state and that some data should not be updated

func (*Calls) Reset added in v0.30.0

func (cl *Calls) Reset()

Reset the call counts to zero

type CallsScope added in v0.30.0

type CallsScope struct {
	FrameCount   float32
	AverageCount float32
	MaxCount     float32
	// contains filtered or unexported fields
}

CallsScope records the number of times the entity being measured has been "hit". For a function this equates to the number of times it has been called.

Like the Cycles type, the CallsScope type records figures for the most recent and for the average and maximum cases

type CycleFigures added in v0.30.0

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

	// cycle count expressed as a percentage
	FrameLoad   float32
	AverageLoad float32
	MaxLoad     float32

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

CycleFigures records the number of cycles for the entity being measured, over the course of the most recent frame and the average & maximum number of cycles over all frames

type Cycles added in v0.30.0

type Cycles struct {
	Overall  CyclesScope
	VBLANK   CyclesScope
	Screen   CyclesScope
	Overscan CyclesScope
}

Cycles measures the number of cycles consumed in each VCS scope

func (*Cycles) Cycle added in v0.30.0

func (cy *Cycles) Cycle(n float32, focus Focus)

Cycle advances the number of cycles for the VCS scope

func (*Cycles) NewFrame added in v0.30.0

func (cy *Cycles) NewFrame(programCycles *Cycles, functionCycles *Cycles, rewinding bool)

NewFrame commits accumulated cycles for the frame. The rewinding flag indicates that the emulation is in the rewinding state and that some data should not be updated

The programCycles and functionCycles parameters reprenent the parents of the entity being measured by Cycles instance.

For dwarf.SourceLines the programCycles parameter will point to the Cycles instance for the entire program; and the functionCycles parameter will point to the Cycles instance for the function the line is part of

For dwarf.SourceFunction the functionCycles parameter will be nil.

For dwarf.Source both parameters will be nil

func (*Cycles) Reset added in v0.30.0

func (cy *Cycles) Reset()

Reset the cycles counts to zero

type CyclesPerCall added in v0.30.0

type CyclesPerCall struct {
	Overall  CyclesPerCallScope
	VBLANK   CyclesPerCallScope
	Screen   CyclesPerCallScope
	Overscan CyclesPerCallScope
}

CyclesPerCall measures the number of cycles consumed by a function divided by the number of times its been called, in each VCS scope. It only makes sense for this type to be used in the context of functions

func (*CyclesPerCall) Call added in v0.30.0

func (cl *CyclesPerCall) Call(focus Focus)

Call registers a new instance of the function being called

func (*CyclesPerCall) Check added in v0.30.0

func (cl *CyclesPerCall) Check(focus Focus)

Check is like call except that it only makes sure that the call figure is at least one. It's useful to make sure a function has been called at least once if it is part of the call stack

func (*CyclesPerCall) Cycle added in v0.30.0

func (cl *CyclesPerCall) Cycle(n float32, focus Focus)

Cycle advances the number of cycles for the VCS scope

func (*CyclesPerCall) NewFrame added in v0.30.0

func (cl *CyclesPerCall) NewFrame(rewinding bool)

NewFrame commits accumulated cycles and calls for the frame. The rewinding flag indicates that the emulation is in the rewinding state and that some data should not be updated

func (*CyclesPerCall) PostNewFrame added in v0.30.0

func (cl *CyclesPerCall) PostNewFrame(allFunctions float32, rewinding bool)

PostNewFrame is called after NewFrame() has been called for all instances of CyclesPerCall (ie. for all functions)

This is because a total cycles/call value is needed to calculate the load values. If there's a simpler mathematical method of doing this then I'd prefer to do that

func (*CyclesPerCall) Reset added in v0.30.0

func (cl *CyclesPerCall) Reset()

Reset the counts to zero

type CyclesPerCallScope added in v0.30.0

type CyclesPerCallScope struct {
	FrameCount   float32
	AverageCount float32
	MaxCount     float32

	FrameLoad   float32
	AverageLoad float32
	MaxLoad     float32

	// whether the corresponding values are valid
	FrameValid   bool
	AverageValid bool
	MaxValid     bool
	// contains filtered or unexported fields
}

type CyclesScope added in v0.30.0

type CyclesScope struct {
	// number of cycles in relation to function and to the entire program
	CyclesFunction CycleFigures
	CyclesProgram  CycleFigures
	// contains filtered or unexported fields
}

CyclesScope 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 CycleScope fields depends on context. For instance, for the SourceFunction type, the CyclesFunction field is invalid. For the Source type meanwhile, neither field is valid.

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

func (*CyclesScope) Cycle added in v0.30.0

func (cy *CyclesScope) Cycle(n float32)

Cycle advances the number of cycles for the current frame

func (*CyclesScope) HasExecuted added in v0.30.0

func (cy *CyclesScope) HasExecuted() bool

HasExecuted returns true if the entity (program, function or line) has ever been executed

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

Jump to

Keyboard shortcuts

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