Skip to content

Commit 2ee2a14

Browse files
Log capture statistics (for now).
1 parent 6718cc8 commit 2ee2a14

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

lib/memory/profiler/sampler.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
# Copyright, 2025, by Samuel Williams.
55

66
require "console"
7+
require "objspace"
78

89
require_relative "capture"
910
require_relative "call_tree"
@@ -151,6 +152,9 @@ def run(interval: 60, &block)
151152

152153
sample!(&block)
153154

155+
# Log capture statistics to detect issues like missing FREEOBJ events:
156+
Console.info(self, "Capture statistics:", statistics: @capture.statistics, object_space: ::ObjectSpace.count_objects)
157+
154158
# Sleep for the remainder of the interval:
155159
now = Process.clock_gettime(Process::CLOCK_MONOTONIC)
156160
delta = interval - (now - start_time)

releases.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
## Unreleased
44

55
- Fix sampler loop interval handling.
6+
- Log capture statistics from sampler run loop.
67

78
## v1.1.12
89

0 commit comments

Comments
 (0)