browsertime 17.2.0 → 17.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # Browsertime changelog (we do [semantic versioning](https://semver.org))
2
2
 
3
+ ## 17.3.0 - 2022-03-26
4
+
5
+ ### Fixed
6
+ * Bumped Selenium-webdriver to 4.8.2 [#1916](https://github.com/sitespeedio/browsertime/pull/1916).
7
+
8
+ ### Added
9
+ * On Linux you can use taskset to assing FFMPEG to specific CPUs using `--videoParams.taskset "0,5,7,9-11" `. It will start FFMPEG with `taskset -c <CPUS>` to pin FFMPG to specific CPU(s). Specify a numerical list of processors. The list may contain multiple items, separated by comma, and ranges. For example, "0,5,7,9-11". Use it together with isolcpus. Added in [#1917](https://github.com/sitespeedio/browsertime/pull/1917).
10
+ ## 17.2.1 - 2022-03-16
11
+ ### Fixed
12
+ * Bumped Geckodriver to 0.32.2 and Edgedriver to 111.
3
13
 
4
14
  ## 17.2.0 - 2022-03-14
5
15
  ### Added
@@ -12,8 +12,15 @@ const animationsToStop = [
12
12
  ];
13
13
 
14
14
  export class RootedDevice {
15
- constructor(androidClient) {
15
+ constructor(androidClient, options) {
16
16
  this.client = androidClient;
17
+ this.options = options;
18
+ }
19
+
20
+ async _setCPU(freq, policy, type) {
21
+ return this.client._runAsRoot(
22
+ `echo ${freq} > /sys/devices/system/cpu/cpufreq/policy${policy}/scaling_${type}_freq`
23
+ );
17
24
  }
18
25
 
19
26
  async stopServices() {
@@ -85,7 +92,7 @@ export class RootedDevice {
85
92
 
86
93
  async setCPUPerformanceSamsungA51() {
87
94
  // Octa-core (4x2.3 GHz Cortex-A73 & 4x1.7 GHz Cortex-A53)
88
- // See values by
95
+ // See values by:
89
96
  // cat /sys/devices/system/cpu/cpufreq/policy0/scaling_available_frequencies
90
97
  // cat /sys/devices/system/cpu/cpufreq/policy4/scaling_available_frequencies
91
98
 
@@ -97,13 +104,79 @@ export class RootedDevice {
97
104
  'echo performance > /sys/devices/system/cpu/cpufreq/policy4/scaling_governor'
98
105
  );
99
106
 
100
- await this.client._runAsRoot(
101
- 'echo 1742000 > /sys/devices/system/cpu/cpufreq/policy0/scaling_min_freq'
102
- );
107
+ // For the Samsung A51 we can choose min/middle or max CPU speed
103
108
 
104
- return this.client._runAsRoot(
105
- 'echo 2314000 > /sys/devices/system/cpu/cpufreq/policy4/scaling_min_freq'
109
+ // Collect the current settings
110
+ const currentMaxPolicy0 = await this.client._runAsRootAndGet(
111
+ 'cat /sys/devices/system/cpu/cpufreq/policy0/scaling_max_freq'
112
+ );
113
+ const currentMinPolicy0 = await this.client._runAsRootAndGet(
114
+ 'cat /sys/devices/system/cpu/cpufreq/policy0/scaling_min_freq'
115
+ );
116
+ const currentMaxPolicy4 = await this.client._runAsRootAndGet(
117
+ 'cat /sys/devices/system/cpu/cpufreq/policy4/scaling_max_freq'
118
+ );
119
+ const currentMinPolicy4 = await this.client._runAsRootAndGet(
120
+ 'cat /sys/devices/system/cpu/cpufreq/policy4/scaling_min_freq'
106
121
  );
122
+
123
+ if (this.options.androidPinCPUSpeed === 'min') {
124
+ log.info('Set min CPU speed');
125
+
126
+ // The min settings, see the possible slowest setting by
127
+ // cat /sys/devices/system/cpu/cpufreq/policy0/scaling_available_frequencies
128
+ const minPolicy0 = 403_000;
129
+ const minPolicy4 = 936_000;
130
+
131
+ // You need to set them in the correct order
132
+ if (Number(currentMinPolicy0) > minPolicy0) {
133
+ await this._setCPU(minPolicy0, '0', 'min');
134
+ await this._setCPU(minPolicy0, '0', 'max');
135
+ } else {
136
+ await this._setCPU(minPolicy0, '0', 'max');
137
+ await this._setCPU(minPolicy0, '0', 'min');
138
+ }
139
+
140
+ if (Number(currentMinPolicy4) > minPolicy4) {
141
+ await this._setCPU(minPolicy4, '4', 'min');
142
+ return this._setCPU(minPolicy4, '4', 'max');
143
+ } else {
144
+ await this._setCPU(minPolicy4, '4', 'max');
145
+ return this._setCPU(minPolicy4, '4', 'min');
146
+ }
147
+ } else if (this.options.androidPinCPUSpeed === 'middle') {
148
+ log.info('Set middle CPU speed');
149
+
150
+ const middlePolicy0 = 910_000;
151
+ const middlePolicy4 = 1_508_000;
152
+
153
+ if (Number(currentMaxPolicy0) > middlePolicy0) {
154
+ await this._setCPU(middlePolicy0, '0', 'min');
155
+ await this._setCPU(middlePolicy0, '0', 'max');
156
+ } else {
157
+ await this._setCPU(middlePolicy0, '0', 'max');
158
+ await this._setCPU(middlePolicy0, '0', 'min');
159
+ }
160
+
161
+ if (Number(currentMaxPolicy4) > middlePolicy4) {
162
+ await this._setCPU(middlePolicy4, '4', 'min');
163
+ return this._setCPU(middlePolicy4, '4', 'max');
164
+ } else {
165
+ await this._setCPU(middlePolicy4, '4', 'max');
166
+ return this._setCPU(middlePolicy4, '4', 'min');
167
+ }
168
+ } else {
169
+ log.info('Set max CPU speed');
170
+
171
+ const maxPolicy0 = 1_742_000;
172
+ const maxPolicy4 = 2_314_000;
173
+
174
+ // set it to max speed
175
+ await this._setCPU(maxPolicy0, '0', 'max');
176
+ await this._setCPU(maxPolicy0, '0', 'min');
177
+ await this._setCPU(maxPolicy4, '4', 'max');
178
+ return this._setCPU(maxPolicy4, '4', 'min');
179
+ }
107
180
  }
108
181
 
109
182
  async setCPUPerformancePixel2() {
@@ -131,7 +131,7 @@ export class Engine {
131
131
  if (gotRoot.includes('not found')) {
132
132
  log.info('Your phone do not have su, is it really rooted?');
133
133
  } else {
134
- this.rooted = new RootedDevice(this.android);
134
+ this.rooted = new RootedDevice(this.android, options);
135
135
  await this.rooted.start();
136
136
  }
137
137
  }
@@ -638,6 +638,11 @@ export function parseCommandLine() {
638
638
  'Use nice when running FFMPEG during the run. A value from -20 to 19 https://linux.die.net/man/1/nice',
639
639
  group: 'video'
640
640
  })
641
+ .option('videoParams.taskset', {
642
+ describe:
643
+ 'Start FFMPEG with taskset -c <CPUS> to pin FFMPG to specific CPU(s). Specify a numerical list of processors. The list may contain multiple items, separated by comma, and ranges. For example, "0,5,7,9-11".',
644
+ group: 'video'
645
+ })
641
646
  .option('videoParams.convert', {
642
647
  type: 'boolean',
643
648
  default: true,
@@ -715,6 +720,14 @@ export function parseCommandLine() {
715
720
  'If your phone is rooted you can use this to set it up following Mozillas best practice for stable metrics.',
716
721
  group: 'android'
717
722
  })
723
+ .option('android.pinCPUSpeed', {
724
+ alias: 'androidPinCPUSpeed',
725
+ choices: ['min', 'middle', 'max'],
726
+ default: 'min',
727
+ describe:
728
+ 'Using a Samsung A51 you can choose how to pin the CPU to better align the speed with your users',
729
+ group: 'android'
730
+ })
718
731
  .option('android.batteryTemperatureLimit', {
719
732
  alias: 'androidBatteryTemperatureLimit',
720
733
  type: 'integer',
@@ -25,6 +25,7 @@ export class DesktopRecorder {
25
25
  this.convert = get(options, 'videoParams.convert', _convert);
26
26
  this.threads = get(options, 'videoParams.threads', _threads);
27
27
  this.viewPort = getViewPort(options);
28
+ this.taskset = get(options, 'videoParams.taskset');
28
29
  this.origin = '0,0';
29
30
  this.offset = { x: 0, y: 0 };
30
31
  this.options = options;
@@ -42,7 +43,8 @@ export class DesktopRecorder {
42
43
  framerate: this.framerate,
43
44
  crf: this.crf,
44
45
  nice: this.nice,
45
- threads: this.threads
46
+ threads: this.threads,
47
+ taskset: this.taskset
46
48
  });
47
49
 
48
50
  return this.recording;
@@ -84,7 +84,7 @@ async function buildX11FfmpegArguments({
84
84
  }
85
85
  }
86
86
 
87
- async function startRecording(ffmpegArguments, nice, filePath) {
87
+ async function startRecording(ffmpegArguments, nice, taskset, filePath) {
88
88
  async function waitForRecording(readableStream) {
89
89
  return new Promise((resolve, reject) => {
90
90
  readableStream.on('data', data => {
@@ -98,7 +98,14 @@ async function startRecording(ffmpegArguments, nice, filePath) {
98
98
  });
99
99
  }
100
100
  let ffmpegProcess;
101
- if (nice === 0) {
101
+ if (taskset) {
102
+ log.debug('Start FFMPEG with taskset cpulist %j', taskset);
103
+ ffmpegArguments.unshift('ffmpeg');
104
+ ffmpegArguments.unshift(`${taskset}`);
105
+ ffmpegArguments.unshift('-c');
106
+ log.debug('Start FFMPEG with %j', ffmpegArguments);
107
+ ffmpegProcess = execa('taskset', ffmpegArguments);
108
+ } else if (nice === 0) {
102
109
  log.debug('Start FFMPEG with %j', ffmpegArguments);
103
110
  ffmpegProcess = execa('ffmpeg', ffmpegArguments);
104
111
  } else {
@@ -137,7 +144,8 @@ async function start({
137
144
  framerate,
138
145
  crf,
139
146
  nice,
140
- threads
147
+ threads,
148
+ taskset
141
149
  }) {
142
150
  const widthAndHeight = size.split('x');
143
151
  const withoutTopBar =
@@ -156,7 +164,7 @@ async function start({
156
164
  offset,
157
165
  threads
158
166
  });
159
- return startRecording(ffmpegArguments, nice, filePath);
167
+ return startRecording(ffmpegArguments, nice, taskset, filePath);
160
168
  }
161
169
  export /**
162
170
  * @returns A promise for a recording result, with a filePath property.
package/package.json CHANGED
@@ -1,15 +1,15 @@
1
1
  {
2
2
  "name": "browsertime",
3
3
  "description": "Get performance metrics from your web page using Browsertime.",
4
- "version": "17.2.0",
4
+ "version": "17.3.0",
5
5
  "bin": "./bin/browsertime.js",
6
6
  "type": "module",
7
7
  "dependencies": {
8
8
  "@cypress/xvfb": "1.2.4",
9
9
  "@devicefarmer/adbkit": "2.11.3",
10
10
  "@sitespeed.io/chromedriver": "111.0.5563-64",
11
- "@sitespeed.io/edgedriver": "109.0.1518-70",
12
- "@sitespeed.io/geckodriver": "0.32.0",
11
+ "@sitespeed.io/edgedriver": "111.0.1661-41",
12
+ "@sitespeed.io/geckodriver": "0.32.2",
13
13
  "@sitespeed.io/throttle": "5.0.0",
14
14
  "@sitespeed.io/tracium": "0.3.3",
15
15
  "btoa": "1.2.1",
@@ -28,7 +28,7 @@
28
28
  "lodash.merge": "4.6.2",
29
29
  "lodash.pick": "4.4.0",
30
30
  "lodash.set": "4.3.2",
31
- "selenium-webdriver": "4.8.1",
31
+ "selenium-webdriver": "4.8.2",
32
32
  "yargs": "17.7.1"
33
33
  },
34
34
  "optionalDependencies": {