|
|
If DEBUG is set to true, profiling will display CPU usage inside and outside of main loop as well as average usage and bucket each tick. You can adjust the parameters below to set the minimum threshold before it reports on something. After testing, it is shown to add 2-3% CPU overhead when enabled, and marginal CPU usage for DEBUG. If PROFILE and DEBUG are set to false, it replaces all functions with empty calls so there is no overhead.
|
|
|
|
|
|
Important Parameters to set
|
|
|
|
|
|
PROFILE: false, // enable CPU profiling
|
|
|
PROFILING: {
|
|
|
ANALYZE_LIMIT: 2, // profile warning levels
|
|
|
AVERAGE_USAGE: true, // display average creep & flag usage
|
|
|
EXECUTE_LIMIT: 5, // profile warning levels
|
|
|
FLUSH_LIMIT: 5, // profile warning levels
|
|
|
REGISTER_LIMIT: 2, // profile warning levels
|
|
|
},
|
|
|
|
|
|
If you would like to use it to profile your own code use:
|
|
|
const p = startProfiling(name);
|
|
|
p.checkCPU(localName, CPULimit) // will display the amount CPU has changed since startProfiling or the last call to checkCPU
|
|
|
|
|
|
Optionally you can call p.checkCPU(localName, CPULimit, type) to store average CPU usage for that type (that's how creep & flag average usage is calculated.
|
|
|
|
|
|
To profile memory usage you can use the tool `Util.memoryUsage(<memory location>)` eg. `Util.memoryUsage(Memory.rooms)` to get more detailed information. |
|
|
\ No newline at end of file |