-
Notifications
You must be signed in to change notification settings - Fork 9.3k
/
memory-gatherer.js
32 lines (25 loc) · 749 Bytes
/
memory-gatherer.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
/**
* @license
* Copyright 2023 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import {Gatherer} from 'lighthouse';
class MemoryProfile extends Gatherer {
meta = {
supportedModes: ['navigation', 'timespan'],
};
async startInstrumentation(context) {
const session = context.driver.defaultSession;
await session.sendCommand('Memory.startSampling');
}
async stopInstrumentation(context) {
const session = context.driver.defaultSession;
await session.sendCommand('Memory.stopSampling');
}
async getArtifact(context) {
const session = context.driver.defaultSession;
const {profile} = await session.sendCommand('Memory.getSamplingProfile');
return profile;
}
}
export default MemoryProfile;