Class: Selenium::DevTools::V85::HeapProfiler
- Inherits:
-
Object
- Object
- Selenium::DevTools::V85::HeapProfiler
- Defined in:
- lib/selenium/devtools/v85/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) ⇒ 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) ⇒ Object
- #take_heap_snapshot(report_progress: nil, treat_global_objects_as_roots: nil) ⇒ Object
Constructor Details
#initialize(devtools) ⇒ HeapProfiler
Returns a new instance of HeapProfiler.
33 34 35 |
# File 'lib/selenium/devtools/v85/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/v85/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/v85/heap_profiler.rb', line 47 def collect_garbage @devtools.send_cmd('HeapProfiler.collectGarbage') end |
#disable ⇒ Object
51 52 53 |
# File 'lib/selenium/devtools/v85/heap_profiler.rb', line 51 def disable @devtools.send_cmd('HeapProfiler.disable') end |
#enable ⇒ Object
55 56 57 |
# File 'lib/selenium/devtools/v85/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/v85/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/v85/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/v85/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/v85/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) ⇒ Object
74 75 76 77 |
# File 'lib/selenium/devtools/v85/heap_profiler.rb', line 74 def start_sampling(sampling_interval: nil) @devtools.send_cmd('HeapProfiler.startSampling', samplingInterval: sampling_interval) end |
#start_tracking_heap_objects(track_allocations: nil) ⇒ Object
79 80 81 82 |
# File 'lib/selenium/devtools/v85/heap_profiler.rb', line 79 def start_tracking_heap_objects(track_allocations: nil) @devtools.send_cmd('HeapProfiler.startTrackingHeapObjects', trackAllocations: track_allocations) end |
#stop_sampling ⇒ Object
84 85 86 |
# File 'lib/selenium/devtools/v85/heap_profiler.rb', line 84 def stop_sampling @devtools.send_cmd('HeapProfiler.stopSampling') end |
#stop_tracking_heap_objects(report_progress: nil, treat_global_objects_as_roots: nil) ⇒ Object
88 89 90 91 92 |
# File 'lib/selenium/devtools/v85/heap_profiler.rb', line 88 def stop_tracking_heap_objects(report_progress: nil, treat_global_objects_as_roots: nil) @devtools.send_cmd('HeapProfiler.stopTrackingHeapObjects', reportProgress: report_progress, treatGlobalObjectsAsRoots: treat_global_objects_as_roots) end |
#take_heap_snapshot(report_progress: nil, treat_global_objects_as_roots: nil) ⇒ Object
94 95 96 97 98 |
# File 'lib/selenium/devtools/v85/heap_profiler.rb', line 94 def take_heap_snapshot(report_progress: nil, treat_global_objects_as_roots: nil) @devtools.send_cmd('HeapProfiler.takeHeapSnapshot', reportProgress: report_progress, treatGlobalObjectsAsRoots: treat_global_objects_as_roots) end |