Bug 1877642 - Disable browser_fullscreen-tab-close-race.js on apple_silicon !debug...
[gecko.git] / testing / mozbase / docs / mozpower.rst
blob76be41d987299cf9b5c5d039fbf9f916ac7c04ca
1 :mod:`mozpower` --- Power-usage testing
2 =======================================
4 Mozpower provides an interface through which power usage measurements
5 can be done on any OS and CPU combination (auto-detected) that has
6 been implemented within the module. It provides 2 methods to start
7 and stop the measurement gathering as well as methods to get the
8 result that can also be formatted into a perfherder data blob.
10 Basic Usage
11 -----------
13 Although multiple classes exist within the mozpower module,
14 the only one that should be used is MozPower which is accessible
15 from the top-level of the module. It handles which subclasses
16 should be used depending on the detected OS and CPU combination.
18 .. code-block:: python
20     from mozpower import MozPower
22     mp = MozPower(
23         ipg_measure_duration=600,
24         sampling_rate=1000,
25         output_file_path='tempdir/dataprefix'
26     )
27     mp.initialize_power_measurements()
29     # Run test TEST_NAME
31     mp.finalize_power_measurements(
32         test_name=TEST_NAME,
33         output_dir_path=env['MOZ_UPLOAD_DIR']
34     )
36     # Get complete PERFHERDER_DATA
37     perfherder_data = mp.get_full_perfherder_data('raptor')
39 All the possible known errors that can occur are also provided
40 at the top-level of the module.
42 .. code-block:: python
44     from mozpower import MozPower, IPGExecutableMissingError, OsCpuComboMissingError
46     try:
47         mp = MozPower(ipg_measure_duration=600, sampling_rate=1000)
48     except IPGExecutableMissingError as e:
49         pass
50     except OsCpuComboMissingError as e:
51         pass
54 .. automodule:: mozpower
56 .. _MozPower:
58 MozPower Interface
59 ------------------
61 The following class provides a basic interface to interact with the
62 power measurement tools that have been implemented. The tool used
63 to measure power depends on the OS and CPU combination, i.e. Intel-based
64 MacOS machines would use Intel Power Gadget, while ARM64-based Windows
65 machines would use the native Windows tool powercfg.
67 MozPower
68 ````````
70 .. autoclass:: mozpower.MozPower
72 Measurement methods
73 +++++++++++++++++++
74 .. automethod:: MozPower.initialize_power_measurements(self, **kwargs)
75 .. automethod:: MozPower.finalize_power_measurements(self, **kwargs)
77 Informational methods
78 +++++++++++++++++++++
79 .. automethod:: MozPower.get_perfherder_data(self)
80 .. automethod:: MozPower.get_full_perfherder_data(self, framework, lowerisbetter=True, alertthreshold=2.0)
82 IPGEmptyFileError
83 `````````````````
84 .. autoexception:: mozpower.IPGEmptyFileError
86 IPGExecutableMissingError
87 `````````````````````````
88 .. autoexception:: mozpower.IPGExecutableMissingError
90 IPGMissingOutputFileError
91 `````````````````````````
92 .. autoexception:: mozpower.IPGMissingOutputFileError
94 IPGTimeoutError
95 ```````````````
96 .. autoexception:: mozpower.IPGTimeoutError
98 IPGUnknownValueTypeError
99 ````````````````````````
100 .. autoexception:: mozpower.IPGUnknownValueTypeError
102 MissingProcessorInfoError
103 `````````````````````````
104 .. autoexception:: mozpower.MissingProcessorInfoError
106 OsCpuComboMissingError
107 ``````````````````````
108 .. autoexception:: mozpower.OsCpuComboMissingError
110 PlatformUnsupportedError
111 ````````````````````````
112 .. autoexception:: mozpower.PlatformUnsupportedError