Source code

Revision control

Copy as Markdown

Other Tools

================================
Service Worker Performance Tests
================================
Our performance tests are mochitests running in the `mozperftest
harness. Tests reside under `dom/serviceworkers/test/performance
itemized in perftest.toml. Beyond the standard mochitest machinery,
performance tests define a ``perfMetadata`` variable at the top level, and call:
``info("perfMetrics", JSON.stringify(metrics));``
to report their results, where *metrics* is a map from testpoint name to scalar
numeric value. See the `performance scripts documentation
for more.
They can be run via mach perftest, or as normal mochitests via mach test.
(Currently we can’t run the full manifest, see `bug 1865852
Adding new tests
================
Add files to `perftest.toml
as usual for mochitests.
Modify linux.yml, macosx.yml, and windows11.yml under `taskcluster/kinds/perftest
Currently, each test needs to be added individually to the run command (`here
for example). kind.yml can be ignored–it provides some defaults.
Add your new test to `perfdocs/config.yml
Modify the generated documentation using:
``$ ./mach lint -l perfdocs . --fix --warnings --outgoing``
which will likely cause the command to fail. Running it a second time should
succeed.
Profiler Markers
================
Profiler markers can be used to collect timing data. Markers of known name can be inspected from the perftest. AUTO_PROFILER_MARKER_TEXT must be used, as we need both the start-time and end-time of the marker. For example:
.. code-block:: cpp
AUTO_PROFILER_MARKER_TEXT("interesting thing #1", DOM, {}, ""_ns);
AUTO_PROFILER_MARKER_TEXT("interesting thing #2", DOM, {}, ""_ns);
can be inspected from the perftest:
.. code-block:: js
await startProfiler();
interestingThings();
let pdata = await stopProfiler();
let duration_ms = inspectProfile(pdata, [
"interesting thing #1",
"interesting thing #2"
]);
Staging tests in try jobs
=========================
``$ ./mach try fuzzy --full``
Look for ``‘service-worker`` to find things like:
| >perftest-windows-service-worker
| >perftest-macosx-service-worker
| >perftest-linux-service-worker
|
Results
=======
Results can be found in treeherder on `mozilla-central
and `autoland
for linux-sw, macosx-sw, and win-sw (`example
These symbol names are defined in the .yml files under taskcluster/kinds/perftest.
Contacts
========
| DOM LWS
| `Gregory Mierzwinski <https://people.mozilla.org/p/sparky>`_ (Performance Tools)