The profiler plugin is profiling the project in runtime and reports issues and / or bad practices.
This plugin does not auto initialize, in order to initialize it add
profiler=true
orautoprofiler=true
to the query params.
Example
// playerOptions.json
{
"plugins": {
"profiler": {
"excludeTests": ["shortDecisionDuration"],
"includeTags": ["performance", "playlist"]
}
}
}
- Table of Contents
- Init Options
- Properties
- versionpro
- Methods
- Events
Init Options
options : object
Initialization options for the profiler plugin.
- options :
object
- .excludeTests :
Array.<string>
- .includeTags :
Array.<string>
- .testsOptions :
Object
- .debug :
boolean
- .track :
boolean
- .excludeTests :
options.excludeTests : Array.<string>
List of test names to be excluded.
Default: []
options.includeTags : Array.<string>
List of tag names that only tests with that contains one of those tags will be included. When set to null
all tags are included.
Default: null
options.testsOptions : Object
Options for the tests to override their default values.
Default: {}
options.debug : boolean
Debug mode. When set to true
the plugin will show a debug overlay with useful reports and summary information.
Default: true
options.track : boolean
Track mode. When set to true
the plugin will track its events to EA. It will also call summary method on each ended, replay and end.started player events.
Default: false
Properties
player.profiler.version : string
The profiler plugin’s version string.
Example
console.log('The profiler plugin version is', player.profiler.version);
Methods
player.profiler.reports([options]) ⇒ Array.<module:Report>
Get the reports from all the tests.
Returns: Array.<module:Report>
- List of the reports.
See: report
Param | Type | Description |
---|---|---|
[options] | object |
An optional options object. |
[options.test] | string | Array.<string> |
A string or array of strings of test names to get the reports from specific tests. |
[options.tag] | string | Array.<string> |
A string or array of strings of tags to get the reports from tests with specific tags. Note that if test property was given to options this property will be ignored. |
Example
player.profiler.reports({test: 'lowFps'});
player.profiler.summary([options]) ⇒ object
Get the summaries from all the tests.
Returns: object
- An object contains the summaries (key-value: ‘testName’->Summary)
See: summary
Param | Type | Description |
---|---|---|
[options] | object |
An optional options object. |
[options.test] | string | Array.<string> |
A string or array of strings of test names to get the summaries from specific tests. |
[options.tag] | string | Array.<string> |
A string or array of strings of tags to get the summaries from tests with specific tags. Note that if test property was given to options this property will be ignored. |
Example
player.profiler.summary({tag: ['playlist', 'performance']});
Events
“profiler.report”
Triggered when a report was added.
See: report
Param | Type | Description |
---|---|---|
report | report |
The report object. |
Example
player.on('profiler.report', function(report) {
console.log('Report from test', report.test, 'was added.');
});
“profiler.summary”
Triggered when a test’s summary was called.
See: summary
Param | Type | Description |
---|---|---|
summary | summary |
The summary object. |
Example
player.on('profiler.summary', function(summary) {
console.log('New summary for test', summary.test);
});
Objects
report : object
An object contains data of a test report.
- report :
object
- .test :
string
- .tags :
Array.<string>
- .msg :
string
- .extraData :
object
- .test :
report.test : string
The test that associated with the report.
report.tags : Array.<string>
The tags of the test that was reported the report.
report.msg : string
The message of the report.
report.extraData : object
Additional data of the report.
summary : object
An object contains data of a test summary.
- summary :
object
- .test :
string
- .tags :
Array.<string>
- .msg :
string
- .extraData :
object
- .pass :
boolean
- .test :
summary.test : string
The test associated with the summary.
summary.tags : Array.<string>
The tags of the test that associated with the summary.
summary.msg : string
The message of the summary.
summary.extraData : object
Additional data of the summary.
summary.pass : boolean
Indication whether the test was passed.
If null
it means that the test is not considered as pass or fail.