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 ¶
- func CalcFPS(tv *television.Television, numFrames int, duration float64) (fps float64, accuracy float64)
- func Check(output io.Writer, profile Profile, tv *television.Television, scr gui.GUI, ...) error
- func RunProfiler(profile Profile, filenameHeader string, run func() error) (rerr error)
- type Profile
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, tv *television.Television, scr gui.GUI, runTime string, cartload cartridgeloader.Loader) error
Check is a very rough and ready calculation of the emulator's performance.
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
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.