Class: Selenium::DevTools::V151::HeapProfiler
- Inherits:
-
Object
- Object
- Selenium::DevTools::V151::HeapProfiler
- Defined in:
- lib/selenium/devtools/v151/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, stack_depth: 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.
34 35 36 |
# File 'lib/selenium/devtools/v151/heap_profiler.rb', line 34 def initialize(devtools) @devtools = devtools end |
Instance Method Details
#add_inspected_heap_object(heap_object_id:) ⇒ Object
43 44 45 46 |
# File 'lib/selenium/devtools/v151/heap_profiler.rb', line 43 def add_inspected_heap_object(heap_object_id:) @devtools.send_cmd('HeapProfiler.addInspectedHeapObject', heapObjectId: heap_object_id) end |
#collect_garbage ⇒ Object
48 49 50 |
# File 'lib/selenium/devtools/v151/heap_profiler.rb', line 48 def collect_garbage @devtools.send_cmd('HeapProfiler.collectGarbage') end |
#disable ⇒ Object
52 53 54 |
# File 'lib/selenium/devtools/v151/heap_profiler.rb', line 52 def disable @devtools.send_cmd('HeapProfiler.disable') end |
#enable ⇒ Object
56 57 58 |
# File 'lib/selenium/devtools/v151/heap_profiler.rb', line 56 def enable @devtools.send_cmd('HeapProfiler.enable') end |
#get_heap_object_id(object_id:) ⇒ Object
60 61 62 63 |
# File 'lib/selenium/devtools/v151/heap_profiler.rb', line 60 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
65 66 67 68 69 |
# File 'lib/selenium/devtools/v151/heap_profiler.rb', line 65 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
71 72 73 |
# File 'lib/selenium/devtools/v151/heap_profiler.rb', line 71 def get_sampling_profile @devtools.send_cmd('HeapProfiler.getSamplingProfile') end |
#on(event, &block) ⇒ Object
38 39 40 41 |
# File 'lib/selenium/devtools/v151/heap_profiler.rb', line 38 def on(event, &block) event = EVENTS[event] if event.is_a?(Symbol) @devtools.callbacks["HeapProfiler.#{event}"] << block end |
#start_sampling(sampling_interval: nil, stack_depth: nil, include_objects_collected_by_major_gc: nil, include_objects_collected_by_minor_gc: nil) ⇒ Object
75 76 77 78 79 80 81 |
# File 'lib/selenium/devtools/v151/heap_profiler.rb', line 75 def start_sampling(sampling_interval: nil, stack_depth: nil, include_objects_collected_by_major_gc: nil, include_objects_collected_by_minor_gc: nil) @devtools.send_cmd('HeapProfiler.startSampling', samplingInterval: sampling_interval, stackDepth: stack_depth, includeObjectsCollectedByMajorGC: include_objects_collected_by_major_gc, includeObjectsCollectedByMinorGC: include_objects_collected_by_minor_gc) end |
#start_tracking_heap_objects(track_allocations: nil) ⇒ Object
83 84 85 86 |
# File 'lib/selenium/devtools/v151/heap_profiler.rb', line 83 def start_tracking_heap_objects(track_allocations: nil) @devtools.send_cmd('HeapProfiler.startTrackingHeapObjects', trackAllocations: track_allocations) end |
#stop_sampling ⇒ Object
88 89 90 |
# File 'lib/selenium/devtools/v151/heap_profiler.rb', line 88 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
92 93 94 95 96 97 98 |
# File 'lib/selenium/devtools/v151/heap_profiler.rb', line 92 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
100 101 102 103 104 105 106 |
# File 'lib/selenium/devtools/v151/heap_profiler.rb', line 100 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 |