Class: Selenium::DevTools::V131::HeapProfiler
- Inherits:
-
Object
- Object
- Selenium::DevTools::V131::HeapProfiler
- Defined in:
- lib/selenium/devtools/v131/heap_profiler.rb
Constant Summary collapse
- EVENTS =
{ add_heap_snapshot_chunk: 'addHeapSnapshotChunk', heap_stats_update: 'heapStatsUpdate', last_seen_object_id: 'lastSeenObjectId', report_heap_snapshot_progress: 'reportHeapSnapshotProgress', reset_profiles: 'resetProfiles', }.freeze
Instance Method Summary collapse
- #add_inspected_heap_object(heap_object_id:) ⇒ Object
- #collect_garbage ⇒ Object
- #disable ⇒ Object
- #enable ⇒ Object
- #get_heap_object_id(object_id:) ⇒ Object
- #get_object_by_heap_object_id(object_id:, object_group: nil) ⇒ Object
- #get_sampling_profile ⇒ Object
-
#initialize(devtools) ⇒ HeapProfiler
constructor
A new instance of HeapProfiler.
- #on(event, &block) ⇒ Object
- #start_sampling(sampling_interval: nil, include_objects_collected_by_major_gc: nil, include_objects_collected_by_minor_gc: nil) ⇒ Object
- #start_tracking_heap_objects(track_allocations: nil) ⇒ Object
- #stop_sampling ⇒ Object
- #stop_tracking_heap_objects(report_progress: nil, treat_global_objects_as_roots: nil, capture_numeric_value: nil, expose_internals: nil) ⇒ Object
- #take_heap_snapshot(report_progress: nil, treat_global_objects_as_roots: nil, capture_numeric_value: nil, expose_internals: nil) ⇒ Object
Constructor Details
#initialize(devtools) ⇒ HeapProfiler
Returns a new instance of HeapProfiler.
33 34 35 |
# File 'lib/selenium/devtools/v131/heap_profiler.rb', line 33 def initialize(devtools) @devtools = devtools end |
Instance Method Details
#add_inspected_heap_object(heap_object_id:) ⇒ Object
42 43 44 45 |
# File 'lib/selenium/devtools/v131/heap_profiler.rb', line 42 def add_inspected_heap_object(heap_object_id:) @devtools.send_cmd('HeapProfiler.addInspectedHeapObject', heapObjectId: heap_object_id) end |
#collect_garbage ⇒ Object
47 48 49 |
# File 'lib/selenium/devtools/v131/heap_profiler.rb', line 47 def collect_garbage @devtools.send_cmd('HeapProfiler.collectGarbage') end |
#disable ⇒ Object
51 52 53 |
# File 'lib/selenium/devtools/v131/heap_profiler.rb', line 51 def disable @devtools.send_cmd('HeapProfiler.disable') end |
#enable ⇒ Object
55 56 57 |
# File 'lib/selenium/devtools/v131/heap_profiler.rb', line 55 def enable @devtools.send_cmd('HeapProfiler.enable') end |
#get_heap_object_id(object_id:) ⇒ Object
59 60 61 62 |
# File 'lib/selenium/devtools/v131/heap_profiler.rb', line 59 def get_heap_object_id(object_id:) @devtools.send_cmd('HeapProfiler.getHeapObjectId', objectId: object_id) end |
#get_object_by_heap_object_id(object_id:, object_group: nil) ⇒ Object
64 65 66 67 68 |
# File 'lib/selenium/devtools/v131/heap_profiler.rb', line 64 def get_object_by_heap_object_id(object_id:, object_group: nil) @devtools.send_cmd('HeapProfiler.getObjectByHeapObjectId', objectId: object_id, objectGroup: object_group) end |
#get_sampling_profile ⇒ Object
70 71 72 |
# File 'lib/selenium/devtools/v131/heap_profiler.rb', line 70 def get_sampling_profile @devtools.send_cmd('HeapProfiler.getSamplingProfile') end |
#on(event, &block) ⇒ Object
37 38 39 40 |
# File 'lib/selenium/devtools/v131/heap_profiler.rb', line 37 def on(event, &block) event = EVENTS[event] if event.is_a?(Symbol) @devtools.callbacks["HeapProfiler.#{event}"] << block end |
#start_sampling(sampling_interval: nil, include_objects_collected_by_major_gc: nil, include_objects_collected_by_minor_gc: nil) ⇒ Object
74 75 76 77 78 79 |
# File 'lib/selenium/devtools/v131/heap_profiler.rb', line 74 def start_sampling(sampling_interval: nil, include_objects_collected_by_major_gc: nil, include_objects_collected_by_minor_gc: nil) @devtools.send_cmd('HeapProfiler.startSampling', samplingInterval: sampling_interval, includeObjectsCollectedByMajorGC: include_objects_collected_by_major_gc, includeObjectsCollectedByMinorGC: include_objects_collected_by_minor_gc) end |
#start_tracking_heap_objects(track_allocations: nil) ⇒ Object
81 82 83 84 |
# File 'lib/selenium/devtools/v131/heap_profiler.rb', line 81 def start_tracking_heap_objects(track_allocations: nil) @devtools.send_cmd('HeapProfiler.startTrackingHeapObjects', trackAllocations: track_allocations) end |
#stop_sampling ⇒ Object
86 87 88 |
# File 'lib/selenium/devtools/v131/heap_profiler.rb', line 86 def stop_sampling @devtools.send_cmd('HeapProfiler.stopSampling') end |
#stop_tracking_heap_objects(report_progress: nil, treat_global_objects_as_roots: nil, capture_numeric_value: nil, expose_internals: nil) ⇒ Object
90 91 92 93 94 95 96 |
# File 'lib/selenium/devtools/v131/heap_profiler.rb', line 90 def stop_tracking_heap_objects(report_progress: nil, treat_global_objects_as_roots: nil, capture_numeric_value: nil, expose_internals: nil) @devtools.send_cmd('HeapProfiler.stopTrackingHeapObjects', reportProgress: report_progress, treatGlobalObjectsAsRoots: treat_global_objects_as_roots, captureNumericValue: capture_numeric_value, exposeInternals: expose_internals) end |
#take_heap_snapshot(report_progress: nil, treat_global_objects_as_roots: nil, capture_numeric_value: nil, expose_internals: nil) ⇒ Object
98 99 100 101 102 103 104 |
# File 'lib/selenium/devtools/v131/heap_profiler.rb', line 98 def take_heap_snapshot(report_progress: nil, treat_global_objects_as_roots: nil, capture_numeric_value: nil, expose_internals: nil) @devtools.send_cmd('HeapProfiler.takeHeapSnapshot', reportProgress: report_progress, treatGlobalObjectsAsRoots: treat_global_objects_as_roots, captureNumericValue: capture_numeric_value, exposeInternals: expose_internals) end |