All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.openqa.selenium.devtools.v124.heapprofiler.HeapProfiler Maven / Gradle / Ivy

Go to download

Selenium automates browsers. That's it! What you do with that power is entirely up to you.

There is a newer version: 4.22.0
Show newest version
package org.openqa.selenium.devtools.v124.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 java.util.Map;
import java.util.LinkedHashMap;
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.v124.heapprofiler.model.HeapSnapshotObjectId heapObjectId) {
        java.util.Objects.requireNonNull(heapObjectId, "heapObjectId is required");
        LinkedHashMap params = new LinkedHashMap<>();
        params.put("heapObjectId", heapObjectId);
        return new Command<>("HeapProfiler.addInspectedHeapObject", Map.copyOf(params));
    }

    public static Command collectGarbage() {
        LinkedHashMap params = new LinkedHashMap<>();
        return new Command<>("HeapProfiler.collectGarbage", Map.copyOf(params));
    }

    public static Command disable() {
        LinkedHashMap params = new LinkedHashMap<>();
        return new Command<>("HeapProfiler.disable", Map.copyOf(params));
    }

    public static Command enable() {
        LinkedHashMap params = new LinkedHashMap<>();
        return new Command<>("HeapProfiler.enable", Map.copyOf(params));
    }

    public static Command getHeapObjectId(org.openqa.selenium.devtools.v124.runtime.model.RemoteObjectId objectId) {
        java.util.Objects.requireNonNull(objectId, "objectId is required");
        LinkedHashMap params = new LinkedHashMap<>();
        params.put("objectId", objectId);
        return new Command<>("HeapProfiler.getHeapObjectId", Map.copyOf(params), ConverterFunctions.map("heapSnapshotObjectId", org.openqa.selenium.devtools.v124.heapprofiler.model.HeapSnapshotObjectId.class));
    }

    public static Command getObjectByHeapObjectId(org.openqa.selenium.devtools.v124.heapprofiler.model.HeapSnapshotObjectId objectId, java.util.Optional objectGroup) {
        java.util.Objects.requireNonNull(objectId, "objectId is required");
        LinkedHashMap params = new LinkedHashMap<>();
        params.put("objectId", objectId);
        objectGroup.ifPresent(p -> params.put("objectGroup", p));
        return new Command<>("HeapProfiler.getObjectByHeapObjectId", Map.copyOf(params), ConverterFunctions.map("result", org.openqa.selenium.devtools.v124.runtime.model.RemoteObject.class));
    }

    public static Command getSamplingProfile() {
        LinkedHashMap params = new LinkedHashMap<>();
        return new Command<>("HeapProfiler.getSamplingProfile", Map.copyOf(params), ConverterFunctions.map("profile", org.openqa.selenium.devtools.v124.heapprofiler.model.SamplingHeapProfile.class));
    }

    public static Command startSampling(java.util.Optional samplingInterval, java.util.Optional includeObjectsCollectedByMajorGC, java.util.Optional includeObjectsCollectedByMinorGC) {
        LinkedHashMap params = new LinkedHashMap<>();
        samplingInterval.ifPresent(p -> params.put("samplingInterval", p));
        includeObjectsCollectedByMajorGC.ifPresent(p -> params.put("includeObjectsCollectedByMajorGC", p));
        includeObjectsCollectedByMinorGC.ifPresent(p -> params.put("includeObjectsCollectedByMinorGC", p));
        return new Command<>("HeapProfiler.startSampling", Map.copyOf(params));
    }

    public static Command startTrackingHeapObjects(java.util.Optional trackAllocations) {
        LinkedHashMap params = new LinkedHashMap<>();
        trackAllocations.ifPresent(p -> params.put("trackAllocations", p));
        return new Command<>("HeapProfiler.startTrackingHeapObjects", Map.copyOf(params));
    }

    public static Command stopSampling() {
        LinkedHashMap params = new LinkedHashMap<>();
        return new Command<>("HeapProfiler.stopSampling", Map.copyOf(params), ConverterFunctions.map("profile", org.openqa.selenium.devtools.v124.heapprofiler.model.SamplingHeapProfile.class));
    }

    public static Command stopTrackingHeapObjects(java.util.Optional reportProgress, java.util.Optional treatGlobalObjectsAsRoots, java.util.Optional captureNumericValue, java.util.Optional exposeInternals) {
        LinkedHashMap params = new LinkedHashMap<>();
        reportProgress.ifPresent(p -> params.put("reportProgress", p));
        treatGlobalObjectsAsRoots.ifPresent(p -> params.put("treatGlobalObjectsAsRoots", p));
        captureNumericValue.ifPresent(p -> params.put("captureNumericValue", p));
        exposeInternals.ifPresent(p -> params.put("exposeInternals", p));
        return new Command<>("HeapProfiler.stopTrackingHeapObjects", Map.copyOf(params));
    }

    public static Command takeHeapSnapshot(java.util.Optional reportProgress, java.util.Optional treatGlobalObjectsAsRoots, java.util.Optional captureNumericValue, java.util.Optional exposeInternals) {
        LinkedHashMap params = new LinkedHashMap<>();
        reportProgress.ifPresent(p -> params.put("reportProgress", p));
        treatGlobalObjectsAsRoots.ifPresent(p -> params.put("treatGlobalObjectsAsRoots", p));
        captureNumericValue.ifPresent(p -> params.put("captureNumericValue", p));
        exposeInternals.ifPresent(p -> params.put("exposeInternals", p));
        return new Command<>("HeapProfiler.takeHeapSnapshot", Map.copyOf(params));
    }

    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", input -> input.readArray(java.lang.Integer.class)));
    }

    public static Event lastSeenObjectId() {
        return new Event<>("HeapProfiler.lastSeenObjectId", input -> input.read(org.openqa.selenium.devtools.v124.heapprofiler.model.LastSeenObjectId.class));
    }

    public static Event reportHeapSnapshotProgress() {
        return new Event<>("HeapProfiler.reportHeapSnapshotProgress", input -> input.read(org.openqa.selenium.devtools.v124.heapprofiler.model.ReportHeapSnapshotProgress.class));
    }

    public static Event resetProfiles() {
        return new Event<>("HeapProfiler.resetProfiles", ConverterFunctions.empty());
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy