Skip to content

Commit 0793d02

Browse files
committed
Use single global queue for event handling.
1 parent 5494761 commit 0793d02

File tree

7 files changed

+593
-271
lines changed

7 files changed

+593
-271
lines changed

ext/extconf.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
append_cflags(["-DRUBY_DEBUG", "-O0"])
1717
end
1818

19-
$srcs = ["memory/profiler/profiler.c", "memory/profiler/capture.c", "memory/profiler/allocations.c"]
19+
$srcs = ["memory/profiler/profiler.c", "memory/profiler/capture.c", "memory/profiler/allocations.c", "memory/profiler/events.c"]
2020
$VPATH << "$(srcdir)/memory/profiler"
2121

2222
# Check for required headers

ext/memory/profiler/allocations.h

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,26 +6,30 @@
66
#include "ruby.h"
77
#include "ruby/st.h"
88

9-
// Per-class allocation tracking record
9+
// Per-class allocation tracking record:
1010
struct Memory_Profiler_Capture_Allocations {
11-
VALUE callback; // Optional Ruby proc/lambda to call on allocation
12-
size_t new_count; // Total allocations seen since tracking started
13-
size_t free_count; // Total frees seen since tracking started
14-
// Live count = new_count - free_count
11+
// Optional Ruby proc/lambda to call on allocation.
12+
VALUE callback;
13+
14+
// Total allocations seen since tracking started.
15+
size_t new_count;
16+
// // Total frees seen since tracking started.
17+
size_t free_count;
18+
// Live count = new_count - free_count.
1519

16-
// For detailed tracking: map object (VALUE) => state (VALUE)
17-
// State is returned from callback on :newobj and passed back on :freeobj
20+
// For detailed tracking: map object (VALUE) => state (VALUE).
21+
// State is returned from callback on `newobj` and passed back on `freeobj`.
1822
st_table *object_states;
1923
};
2024

21-
// Wrap an allocations record in a VALUE
25+
// Wrap an allocations record in a VALUE.
2226
VALUE Memory_Profiler_Allocations_wrap(struct Memory_Profiler_Capture_Allocations *record);
2327

24-
// Get allocations record from wrapper VALUE
28+
// Get allocations record from wrapper VALUE.
2529
struct Memory_Profiler_Capture_Allocations* Memory_Profiler_Allocations_get(VALUE self);
2630

27-
// Clear/reset allocation counts and state for a record
31+
// Clear/reset allocation counts and state for a record.
2832
void Memory_Profiler_Allocations_clear(VALUE allocations);
2933

30-
// Initialize the Allocations class
34+
// Initialize the Allocations class.
3135
void Init_Memory_Profiler_Allocations(VALUE Memory_Profiler);

0 commit comments

Comments
 (0)