org.openqa.selenium.devtools.v85.heapprofiler.HeapProfiler Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of selenium-devtools-v85 Show documentation
Show all versions of selenium-devtools-v85 Show documentation
Selenium automates browsers. That's it! What you do with that power is entirely up to you.
package org.openqa.selenium.devtools.v85.heapprofiler;
import org.openqa.selenium.Beta;
import org.openqa.selenium.devtools.Command;
import org.openqa.selenium.devtools.Event;
import org.openqa.selenium.devtools.ConverterFunctions;
import com.google.common.collect.ImmutableMap;
import org.openqa.selenium.json.JsonInput;
@Beta()
public class HeapProfiler {
/**
* Enables console to refer to the node with given id via $x (see Command Line API for more details
* $x functions).
*/
public static Command addInspectedHeapObject(org.openqa.selenium.devtools.v85.heapprofiler.model.HeapSnapshotObjectId heapObjectId) {
java.util.Objects.requireNonNull(heapObjectId, "heapObjectId is required");
ImmutableMap.Builder params = ImmutableMap.builder();
params.put("heapObjectId", heapObjectId);
return new Command<>("HeapProfiler.addInspectedHeapObject", params.build());
}
public static Command collectGarbage() {
ImmutableMap.Builder params = ImmutableMap.builder();
return new Command<>("HeapProfiler.collectGarbage", params.build());
}
public static Command disable() {
ImmutableMap.Builder params = ImmutableMap.builder();
return new Command<>("HeapProfiler.disable", params.build());
}
public static Command enable() {
ImmutableMap.Builder params = ImmutableMap.builder();
return new Command<>("HeapProfiler.enable", params.build());
}
public static Command getHeapObjectId(org.openqa.selenium.devtools.v85.runtime.model.RemoteObjectId objectId) {
java.util.Objects.requireNonNull(objectId, "objectId is required");
ImmutableMap.Builder params = ImmutableMap.builder();
params.put("objectId", objectId);
return new Command<>("HeapProfiler.getHeapObjectId", params.build(), ConverterFunctions.map("heapSnapshotObjectId", org.openqa.selenium.devtools.v85.heapprofiler.model.HeapSnapshotObjectId.class));
}
public static Command getObjectByHeapObjectId(org.openqa.selenium.devtools.v85.heapprofiler.model.HeapSnapshotObjectId objectId, java.util.Optional objectGroup) {
java.util.Objects.requireNonNull(objectId, "objectId is required");
ImmutableMap.Builder params = ImmutableMap.builder();
params.put("objectId", objectId);
objectGroup.ifPresent(p -> params.put("objectGroup", p));
return new Command<>("HeapProfiler.getObjectByHeapObjectId", params.build(), ConverterFunctions.map("result", org.openqa.selenium.devtools.v85.runtime.model.RemoteObject.class));
}
public static Command getSamplingProfile() {
ImmutableMap.Builder params = ImmutableMap.builder();
return new Command<>("HeapProfiler.getSamplingProfile", params.build(), ConverterFunctions.map("profile", org.openqa.selenium.devtools.v85.heapprofiler.model.SamplingHeapProfile.class));
}
public static Command startSampling(java.util.Optional samplingInterval) {
ImmutableMap.Builder params = ImmutableMap.builder();
samplingInterval.ifPresent(p -> params.put("samplingInterval", p));
return new Command<>("HeapProfiler.startSampling", params.build());
}
public static Command startTrackingHeapObjects(java.util.Optional trackAllocations) {
ImmutableMap.Builder params = ImmutableMap.builder();
trackAllocations.ifPresent(p -> params.put("trackAllocations", p));
return new Command<>("HeapProfiler.startTrackingHeapObjects", params.build());
}
public static Command stopSampling() {
ImmutableMap.Builder params = ImmutableMap.builder();
return new Command<>("HeapProfiler.stopSampling", params.build(), ConverterFunctions.map("profile", org.openqa.selenium.devtools.v85.heapprofiler.model.SamplingHeapProfile.class));
}
public static Command stopTrackingHeapObjects(java.util.Optional reportProgress, java.util.Optional treatGlobalObjectsAsRoots) {
ImmutableMap.Builder params = ImmutableMap.builder();
reportProgress.ifPresent(p -> params.put("reportProgress", p));
treatGlobalObjectsAsRoots.ifPresent(p -> params.put("treatGlobalObjectsAsRoots", p));
return new Command<>("HeapProfiler.stopTrackingHeapObjects", params.build());
}
public static Command takeHeapSnapshot(java.util.Optional reportProgress, java.util.Optional treatGlobalObjectsAsRoots) {
ImmutableMap.Builder params = ImmutableMap.builder();
reportProgress.ifPresent(p -> params.put("reportProgress", p));
treatGlobalObjectsAsRoots.ifPresent(p -> params.put("treatGlobalObjectsAsRoots", p));
return new Command<>("HeapProfiler.takeHeapSnapshot", params.build());
}
public static Event addHeapSnapshotChunk() {
return new Event<>("HeapProfiler.addHeapSnapshotChunk", ConverterFunctions.map("chunk", java.lang.String.class));
}
public static Event> heapStatsUpdate() {
return new Event<>("HeapProfiler.heapStatsUpdate", ConverterFunctions.map("statsUpdate", new com.google.common.reflect.TypeToken>() {
}.getType()));
}
public static Event lastSeenObjectId() {
return new Event<>("HeapProfiler.lastSeenObjectId", input -> input.read(org.openqa.selenium.devtools.v85.heapprofiler.model.LastSeenObjectId.class));
}
public static Event reportHeapSnapshotProgress() {
return new Event<>("HeapProfiler.reportHeapSnapshotProgress", input -> input.read(org.openqa.selenium.devtools.v85.heapprofiler.model.ReportHeapSnapshotProgress.class));
}
public static Event resetProfiles() {
return new Event<>("HeapProfiler.resetProfiles", input -> null);
}
}