perfole v1.0.4
Code level performance measuring tool
How to use it
Import package
const PERFORMANCE_TEST = require('perfole') // CommonJS
import PERFORMANCE_TEST from 'perfole' // ES6
Start/stop measurement
PERFORMANCE_TEST.Start({measure:true})
...
PERFORMANCE_TEST.Stop()
Set action start/end points
PERFORMANCE_TEST.ActionStart({name:"actionName"})
...
PERFORMANCE_TEST.ActionEnd({name:"actionName"})
Expected methods order
PERFORMANCE_TEST.Start(...) // start measurement first
PERFORMANCE_TEST.ActionStart(...) // anywhere beetwen start/stop measurement
...
PERFORMANCE_TEST.ActionEnd(...) // anywhere beetwen start/stop measurement
PERFORMANCE_TEST.Stop(...) // stop measurement after all action points
Web Workers (multithreaded)
Since web workers have their own memory space, distinct from the main thread, worker that throws action events must use method CollectActions when receiving message. Example:
worker1.on('message', (message) => {
PERFORMANCE_TEST.CollectActions(message)
});
Results (get results locally or publish results)
Locally PERFORMANCE_TEST.Stop() is async method that will return list of caught actions in following form:
[
PerfAction {
actionName: 'actionName',
startTime: 1695116709310,
endTime: 1695116710311,
duration: 1001,
additionalInfo: '',
uniqueIdentifier: ''
}
]
Publish results For cloud reporting functionality visit www.perfole.com/languages/cloud.html
License
This package is proprietary and is subject to certain usage restrictions. Please refer to the license file for more information.
For license details, see LICENSE.txt file that comes with the package
Note: This package utilizes the Axios library for making HTTP requests. Axios is licensed under the MIT License.