profiler

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 or autoprofiler=true to the query params.

Example

// playerOptions.json
{
    "plugins": {
        "profiler": {
            "excludeTests": ["shortDecisionDuration"],
            "includeTags": ["performance", "playlist"]
        }
    }
}

Init Options

options : object

Initialization options for the profiler plugin.

options.excludeTests : Array.<string>
property

List of test names to be excluded.

Default: []

options.includeTags : Array.<string>
property

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
property

Options for the tests to override their default values.

Default: {}

options.debug : boolean
property

Debug mode. When set to true the plugin will show a debug overlay with useful reports and summary information.

Default: true

options.track : boolean
property

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
propertyreadonly

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>
method

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
method

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”
event

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”
event

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.test : string
property

The test that associated with the report.

report.tags : Array.<string>
property

The tags of the test that was reported the report.

report.msg : string
property

The message of the report.

report.extraData : object
property

Additional data of the report.

summary : object

An object contains data of a test summary.

summary.test : string
property

The test associated with the summary.

summary.tags : Array.<string>
property

The tags of the test that associated with the summary.

summary.msg : string
property

The message of the summary.

summary.extraData : object
property

Additional data of the summary.

summary.pass : boolean
property

Indication whether the test was passed.
If null it means that the test is not considered as pass or fail.

Rate this page: X
Tell us more!