performance

package
v0.14.1 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2021 License: GPL-3.0, GPL-3.0 Imports: 17 Imported by: 0

Documentation

Overview

Package performance contains helper functions relating to performance.

Check() is a quick way of running the emulation for a fixed duration of time. It will optionally generate profiling information.

RunProfiler() can be used to generate the various profile types. On it's own it will not limit the amount of time the program runs for so it is useful for more real-world situations

CalcFPS() calculates frames-per-second in aggregate along with an accuracy value (as compared to the television specification). Probably not suitable for "live" FPS monitoring.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CalcFPS

func CalcFPS(tv *television.Television, numFrames int, duration float64) (fps float64, accuracy float64)

CalcFPS takes the the number of frames and duration (in seconds) and returns the frames-per-second and the accuracy of that value as a percentage.

func Check

func Check(output io.Writer, profile Profile, includeDetail bool,
	tv *television.Television, scr gui.GUI, cartload cartridgeloader.Loader,
	duration string) error

Check the performance of the emulator using the supplied tv/gui/cartridge combinataion. Emulation will run of specificed duration and will create a cpu, memory profile, a trace (or a combination of those) as defined by the Profile argument. The includeDetail argument will create any profile file with additional detail in the filename.

func RunProfiler added in v0.8.0

func RunProfiler(profile Profile, filenameHeader string, run func() error) (rerr error)

RunProfiler runs supplied function "through" the requested Profile types.

Types

type Profile added in v0.8.0

type Profile int

Profile is used to specify the type of profiling to perform by RunProfiler().

const (
	ProfileNone  Profile = 0b0000
	ProfileCPU   Profile = 0b0001
	ProfileMem   Profile = 0b0010
	ProfileTrace Profile = 0b0100
	ProfileAll   Profile = 0b0111
)

List of valid Profile values. Values can be combined.

func ParseProfileString added in v0.8.0

func ParseProfileString(profile string) (Profile, error)

ParseProfileString checks a returns a profile value in response to a profile string. profile string can contain any combination of "cpu", "mem", "trace" separated by commas. For example:

"cpu,mem"

Will return the numeric value produced by bitwise ORing of ProfileCPU and PorfileMem.

For convenience, a profile string of "all" will select all profilers at once; a string of "none" will be ignored.

Jump to

Keyboard shortcuts

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