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, cartload cartridgeloader.Loader, spec string, uncapped bool, duration string) error
Check the performance of the emulator using the supplied cartridge.
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.
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 ProfileBlock Profile = 0b1000 ProfileAll Profile = 0b1111 )
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.