fiber-profiler 0.1.2 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/ext/fiber/profiler/capture.c +54 -25
- data/lib/fiber/profiler/version.rb +1 -1
- data/readme.md +4 -0
- data/releases.md +4 -0
- data.tar.gz.sig +0 -0
- metadata +2 -13
- metadata.gz.sig +0 -0
- data/ext/Fiber_Profiler.bundle +0 -0
- data/ext/Fiber_Profiler.bundle.dSYM/Contents/Info.plist +0 -20
- data/ext/Fiber_Profiler.bundle.dSYM/Contents/Resources/DWARF/Fiber_Profiler.bundle +0 -0
- data/ext/Fiber_Profiler.bundle.dSYM/Contents/Resources/Relocations/aarch64/Fiber_Profiler.bundle.yml +0 -5
- data/ext/Makefile +0 -273
- data/ext/capture.o +0 -0
- data/ext/extconf.h +0 -5
- data/ext/fiber.o +0 -0
- data/ext/mkmf.log +0 -69
- data/ext/profiler.o +0 -0
- data/ext/time.o +0 -0
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a2bbdd5d629b193bb2c9fe87a9935abda45b21339bc9fa8e9a177a3cb08c6ca4
|
|
4
|
+
data.tar.gz: c38ff2d79d1dcc2cef0745923da73c0e1bfda612623d1592fffbeb708d6ff97f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a23c926af43a1db2f2cf71b269bbb63d0bff602ca17b40ced3da152dd317d084c2f41f47c42ba7194a7be67df6be8d17de54a829808a82173bb3dc83303b14bd
|
|
7
|
+
data.tar.gz: afd379c5f799fda50fa7229f4512ff01297e9f7f66a32d0eaab575a77c3b66d9b7cc1d13627609193983173b725b8851bf9240ab8096881bc764b66ba83b9a73
|
checksums.yaml.gz.sig
CHANGED
|
Binary file
|
|
@@ -73,12 +73,14 @@ struct Fiber_Profiler_Capture {
|
|
|
73
73
|
// Calls that are shorter than this filter threshold will be ignored:
|
|
74
74
|
double filter_threshold;
|
|
75
75
|
|
|
76
|
+
// Output handling:
|
|
76
77
|
VALUE output;
|
|
77
78
|
Fiber_Profiler_Stream_Print print;
|
|
78
79
|
struct Fiber_Profiler_Stream stream;
|
|
79
80
|
|
|
80
81
|
// Whether or not the profiler is currently running:
|
|
81
82
|
int running;
|
|
83
|
+
VALUE thread;
|
|
82
84
|
|
|
83
85
|
// Whether or not to capture call data:
|
|
84
86
|
int capture;
|
|
@@ -133,6 +135,7 @@ void Fiber_Profiler_Capture_Call_free(void *element) {
|
|
|
133
135
|
static void Fiber_Profiler_Capture_mark(void *ptr) {
|
|
134
136
|
struct Fiber_Profiler_Capture *profiler = (struct Fiber_Profiler_Capture*)ptr;
|
|
135
137
|
|
|
138
|
+
rb_gc_mark_movable(profiler->thread);
|
|
136
139
|
rb_gc_mark_movable(profiler->output);
|
|
137
140
|
|
|
138
141
|
// If `klass` is stored as a VALUE in calls, we need to mark them here:
|
|
@@ -144,6 +147,7 @@ static void Fiber_Profiler_Capture_mark(void *ptr) {
|
|
|
144
147
|
static void Fiber_Profiler_Capture_compact(void *ptr) {
|
|
145
148
|
struct Fiber_Profiler_Capture *profiler = (struct Fiber_Profiler_Capture*)ptr;
|
|
146
149
|
|
|
150
|
+
profiler->thread = rb_gc_location(profiler->thread);
|
|
147
151
|
profiler->output = rb_gc_location(profiler->output);
|
|
148
152
|
|
|
149
153
|
// If `klass` is stored as a VALUE in calls, we need to update their locations here:
|
|
@@ -213,7 +217,10 @@ VALUE Fiber_Profiler_Capture_allocate(VALUE klass) {
|
|
|
213
217
|
// Initialize the profiler state:
|
|
214
218
|
Fiber_Profiler_Stream_initialize(&profiler->stream);
|
|
215
219
|
profiler->output = Qnil;
|
|
220
|
+
|
|
216
221
|
profiler->running = 0;
|
|
222
|
+
profiler->thread = Qnil;
|
|
223
|
+
|
|
217
224
|
profiler->capture = 0;
|
|
218
225
|
profiler->stalls = 0;
|
|
219
226
|
profiler->nesting = 0;
|
|
@@ -326,16 +333,9 @@ static struct Fiber_Profiler_Capture_Call* profiler_event_record_call(struct Fib
|
|
|
326
333
|
return call;
|
|
327
334
|
}
|
|
328
335
|
|
|
329
|
-
void Fiber_Profiler_Capture_fiber_switch(struct Fiber_Profiler_Capture *profiler);
|
|
330
|
-
|
|
331
336
|
static void Fiber_Profiler_Capture_callback(rb_event_flag_t event_flag, VALUE data, VALUE self, ID id, VALUE klass) {
|
|
332
337
|
struct Fiber_Profiler_Capture *profiler = Fiber_Profiler_Capture_get(data);
|
|
333
338
|
|
|
334
|
-
if (event_flag & RUBY_EVENT_FIBER_SWITCH) {
|
|
335
|
-
Fiber_Profiler_Capture_fiber_switch(profiler);
|
|
336
|
-
return;
|
|
337
|
-
}
|
|
338
|
-
|
|
339
339
|
// We don't want to capture data if we're not running:
|
|
340
340
|
if (!profiler->capture) return;
|
|
341
341
|
|
|
@@ -375,17 +375,24 @@ static void Fiber_Profiler_Capture_callback(rb_event_flag_t event_flag, VALUE da
|
|
|
375
375
|
}
|
|
376
376
|
}
|
|
377
377
|
|
|
378
|
-
|
|
378
|
+
void Fiber_Profiler_Capture_pause(VALUE self) {
|
|
379
379
|
struct Fiber_Profiler_Capture *profiler = Fiber_Profiler_Capture_get(self);
|
|
380
380
|
|
|
381
|
-
if (profiler->
|
|
381
|
+
if (!profiler->capture) return;
|
|
382
382
|
|
|
383
|
-
profiler->
|
|
383
|
+
profiler->capture = 0;
|
|
384
384
|
|
|
385
|
-
|
|
386
|
-
|
|
385
|
+
rb_thread_remove_event_hook_with_data(profiler->thread, Fiber_Profiler_Capture_callback, self);
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
void Fiber_Profiler_Capture_resume(VALUE self) {
|
|
389
|
+
struct Fiber_Profiler_Capture *profiler = Fiber_Profiler_Capture_get(self);
|
|
387
390
|
|
|
388
|
-
|
|
391
|
+
if (profiler->capture) return;
|
|
392
|
+
|
|
393
|
+
profiler->capture = 1;
|
|
394
|
+
|
|
395
|
+
rb_event_flag_t event_flags = 0;
|
|
389
396
|
|
|
390
397
|
if (profiler->track_calls) {
|
|
391
398
|
event_flags |= RUBY_EVENT_CALL | RUBY_EVENT_RETURN;
|
|
@@ -393,12 +400,29 @@ VALUE Fiber_Profiler_Capture_start(VALUE self) {
|
|
|
393
400
|
// event_flags |= RUBY_EVENT_B_CALL | RUBY_EVENT_B_RETURN;
|
|
394
401
|
}
|
|
395
402
|
|
|
396
|
-
|
|
397
|
-
rb_thread_add_event_hook(thread, Fiber_Profiler_Capture_callback, event_flags, self);
|
|
403
|
+
// CRuby will raise an exception if you try to add "INTERNAL_EVENT" hooks at the same time as other hooks, so we do it in two calls:
|
|
404
|
+
rb_thread_add_event_hook(profiler->thread, Fiber_Profiler_Capture_callback, event_flags, self);
|
|
405
|
+
rb_thread_add_event_hook(profiler->thread, Fiber_Profiler_Capture_callback, RUBY_INTERNAL_EVENT_GC_START | RUBY_INTERNAL_EVENT_GC_END_SWEEP, self);
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
void Fiber_Profiler_Capture_fiber_switch(VALUE self);
|
|
409
|
+
|
|
410
|
+
void Fiber_Profiler_Capture_fiber_switch_callback(rb_event_flag_t event_flag, VALUE data, VALUE self, ID id, VALUE klass) {
|
|
411
|
+
Fiber_Profiler_Capture_fiber_switch(data);
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
VALUE Fiber_Profiler_Capture_start(VALUE self) {
|
|
415
|
+
struct Fiber_Profiler_Capture *profiler = Fiber_Profiler_Capture_get(self);
|
|
416
|
+
|
|
417
|
+
if (profiler->running) return Qfalse;
|
|
418
|
+
|
|
419
|
+
profiler->running = 1;
|
|
420
|
+
profiler->thread = rb_thread_current();
|
|
398
421
|
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
422
|
+
Fiber_Profiler_Capture_reset(profiler);
|
|
423
|
+
Fiber_Profiler_Time_current(&profiler->start_time);
|
|
424
|
+
|
|
425
|
+
rb_thread_add_event_hook(profiler->thread, Fiber_Profiler_Capture_fiber_switch_callback, RUBY_EVENT_FIBER_SWITCH, self);
|
|
402
426
|
|
|
403
427
|
return self;
|
|
404
428
|
}
|
|
@@ -408,11 +432,13 @@ VALUE Fiber_Profiler_Capture_stop(VALUE self) {
|
|
|
408
432
|
|
|
409
433
|
if (!profiler->running) return Qfalse;
|
|
410
434
|
|
|
411
|
-
|
|
435
|
+
Fiber_Profiler_Capture_pause(self);
|
|
412
436
|
|
|
413
|
-
|
|
414
|
-
rb_thread_remove_event_hook_with_data(thread, Fiber_Profiler_Capture_callback, self);
|
|
437
|
+
rb_thread_remove_event_hook_with_data(profiler->thread, Fiber_Profiler_Capture_fiber_switch_callback, self);
|
|
415
438
|
|
|
439
|
+
profiler->running = 0;
|
|
440
|
+
profiler->thread = Qnil;
|
|
441
|
+
|
|
416
442
|
Fiber_Profiler_Time_current(&profiler->stop_time);
|
|
417
443
|
Fiber_Profiler_Capture_reset(profiler);
|
|
418
444
|
|
|
@@ -454,26 +480,29 @@ int Fiber_Profiler_Capture_sample(struct Fiber_Profiler_Capture *profiler) {
|
|
|
454
480
|
}
|
|
455
481
|
}
|
|
456
482
|
|
|
457
|
-
void Fiber_Profiler_Capture_fiber_switch(
|
|
483
|
+
void Fiber_Profiler_Capture_fiber_switch(VALUE self)
|
|
458
484
|
{
|
|
485
|
+
struct Fiber_Profiler_Capture *profiler = Fiber_Profiler_Capture_get(self);
|
|
459
486
|
float duration = Fiber_Profiler_Capture_duration(profiler);
|
|
460
487
|
|
|
461
488
|
if (profiler->capture) {
|
|
489
|
+
Fiber_Profiler_Capture_pause(self);
|
|
490
|
+
|
|
462
491
|
Fiber_Profiler_Capture_finish(profiler);
|
|
463
492
|
|
|
464
493
|
if (duration > profiler->stall_threshold) {
|
|
465
494
|
profiler->stalls += 1;
|
|
466
495
|
Fiber_Profiler_Capture_print(profiler);
|
|
467
496
|
}
|
|
497
|
+
|
|
498
|
+
Fiber_Profiler_Capture_reset(profiler);
|
|
468
499
|
}
|
|
469
500
|
|
|
470
|
-
Fiber_Profiler_Capture_reset(profiler);
|
|
471
|
-
|
|
472
501
|
if (Fiber_Profiler_Capture_sample(profiler)) {
|
|
473
502
|
// Reset the start time:
|
|
474
503
|
Fiber_Profiler_Time_current(&profiler->start_time);
|
|
475
504
|
|
|
476
|
-
|
|
505
|
+
Fiber_Profiler_Capture_resume(self);
|
|
477
506
|
}
|
|
478
507
|
}
|
|
479
508
|
|
data/readme.md
CHANGED
|
@@ -18,6 +18,10 @@ Please see the [project documentation](https://socketry.github.io/fiber-profiler
|
|
|
18
18
|
|
|
19
19
|
Please see the [project releases](https://socketry.github.io/fiber-profiler/releases/index) for all releases.
|
|
20
20
|
|
|
21
|
+
### v0.1.3
|
|
22
|
+
|
|
23
|
+
- Improved performance when not profiling (when sampling is enabled).
|
|
24
|
+
|
|
21
25
|
### v0.1.0
|
|
22
26
|
|
|
23
27
|
- Initial implementation extracted from `io-event` gem.
|
data/releases.md
CHANGED
data.tar.gz.sig
CHANGED
|
Binary file
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: fiber-profiler
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Samuel Williams
|
|
@@ -36,22 +36,14 @@ cert_chain:
|
|
|
36
36
|
Q2K9NVun/S785AP05vKkXZEFYxqG6EW012U4oLcFl5MySFajYXRYbuUpH6AY+HP8
|
|
37
37
|
voD0MPg1DssDLKwXyt1eKD/+Fq0bFWhwVM/1XiAXL7lyYUyOq24KHgQ2Csg=
|
|
38
38
|
-----END CERTIFICATE-----
|
|
39
|
-
date: 2025-02-
|
|
39
|
+
date: 2025-02-14 00:00:00.000000000 Z
|
|
40
40
|
dependencies: []
|
|
41
41
|
executables: []
|
|
42
42
|
extensions:
|
|
43
43
|
- ext/extconf.rb
|
|
44
44
|
extra_rdoc_files: []
|
|
45
45
|
files:
|
|
46
|
-
- ext/Fiber_Profiler.bundle
|
|
47
|
-
- ext/Fiber_Profiler.bundle.dSYM/Contents/Info.plist
|
|
48
|
-
- ext/Fiber_Profiler.bundle.dSYM/Contents/Resources/DWARF/Fiber_Profiler.bundle
|
|
49
|
-
- ext/Fiber_Profiler.bundle.dSYM/Contents/Resources/Relocations/aarch64/Fiber_Profiler.bundle.yml
|
|
50
|
-
- ext/Makefile
|
|
51
|
-
- ext/capture.o
|
|
52
|
-
- ext/extconf.h
|
|
53
46
|
- ext/extconf.rb
|
|
54
|
-
- ext/fiber.o
|
|
55
47
|
- ext/fiber/profiler/capture.c
|
|
56
48
|
- ext/fiber/profiler/capture.h
|
|
57
49
|
- ext/fiber/profiler/deque.h
|
|
@@ -61,9 +53,6 @@ files:
|
|
|
61
53
|
- ext/fiber/profiler/profiler.h
|
|
62
54
|
- ext/fiber/profiler/time.c
|
|
63
55
|
- ext/fiber/profiler/time.h
|
|
64
|
-
- ext/mkmf.log
|
|
65
|
-
- ext/profiler.o
|
|
66
|
-
- ext/time.o
|
|
67
56
|
- lib/fiber/profiler.rb
|
|
68
57
|
- lib/fiber/profiler/capture.rb
|
|
69
58
|
- lib/fiber/profiler/native.rb
|
metadata.gz.sig
CHANGED
|
Binary file
|
data/ext/Fiber_Profiler.bundle
DELETED
|
Binary file
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
3
|
-
<plist version="1.0">
|
|
4
|
-
<dict>
|
|
5
|
-
<key>CFBundleDevelopmentRegion</key>
|
|
6
|
-
<string>English</string>
|
|
7
|
-
<key>CFBundleIdentifier</key>
|
|
8
|
-
<string>com.apple.xcode.dsym.Fiber_Profiler.bundle</string>
|
|
9
|
-
<key>CFBundleInfoDictionaryVersion</key>
|
|
10
|
-
<string>6.0</string>
|
|
11
|
-
<key>CFBundlePackageType</key>
|
|
12
|
-
<string>dSYM</string>
|
|
13
|
-
<key>CFBundleSignature</key>
|
|
14
|
-
<string>????</string>
|
|
15
|
-
<key>CFBundleShortVersionString</key>
|
|
16
|
-
<string>1.0</string>
|
|
17
|
-
<key>CFBundleVersion</key>
|
|
18
|
-
<string>1</string>
|
|
19
|
-
</dict>
|
|
20
|
-
</plist>
|
|
Binary file
|
data/ext/Makefile
DELETED
|
@@ -1,273 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
SHELL = /bin/sh
|
|
3
|
-
|
|
4
|
-
# V=0 quiet, V=1 verbose. other values don't work.
|
|
5
|
-
V = 0
|
|
6
|
-
V0 = $(V:0=)
|
|
7
|
-
Q1 = $(V:1=)
|
|
8
|
-
Q = $(Q1:0=@)
|
|
9
|
-
ECHO1 = $(V:1=@ :)
|
|
10
|
-
ECHO = $(ECHO1:0=@ echo)
|
|
11
|
-
NULLCMD = :
|
|
12
|
-
|
|
13
|
-
#### Start of system configuration section. ####
|
|
14
|
-
|
|
15
|
-
srcdir = .
|
|
16
|
-
topdir = /Users/samuel/.rubies/ruby-3.4.1/include/ruby-3.4.0
|
|
17
|
-
hdrdir = $(topdir)
|
|
18
|
-
arch_hdrdir = /Users/samuel/.rubies/ruby-3.4.1/include/ruby-3.4.0/arm64-darwin24
|
|
19
|
-
PATH_SEPARATOR = :
|
|
20
|
-
VPATH = $(srcdir):$(arch_hdrdir)/ruby:$(hdrdir)/ruby:$(srcdir)/fiber/profiler
|
|
21
|
-
prefix = $(DESTDIR)/Users/samuel/.rubies/ruby-3.4.1
|
|
22
|
-
rubysitearchprefix = $(rubylibprefix)/$(sitearch)
|
|
23
|
-
rubyarchprefix = $(rubylibprefix)/$(arch)
|
|
24
|
-
rubylibprefix = $(libdir)/$(RUBY_BASE_NAME)
|
|
25
|
-
exec_prefix = $(prefix)
|
|
26
|
-
vendorarchhdrdir = $(vendorhdrdir)/$(sitearch)
|
|
27
|
-
sitearchhdrdir = $(sitehdrdir)/$(sitearch)
|
|
28
|
-
rubyarchhdrdir = $(rubyhdrdir)/$(arch)
|
|
29
|
-
vendorhdrdir = $(rubyhdrdir)/vendor_ruby
|
|
30
|
-
sitehdrdir = $(rubyhdrdir)/site_ruby
|
|
31
|
-
rubyhdrdir = $(includedir)/$(RUBY_VERSION_NAME)
|
|
32
|
-
vendorarchdir = $(vendorlibdir)/$(sitearch)
|
|
33
|
-
vendorlibdir = $(vendordir)/$(ruby_version)
|
|
34
|
-
vendordir = $(rubylibprefix)/vendor_ruby
|
|
35
|
-
sitearchdir = $(sitelibdir)/$(sitearch)
|
|
36
|
-
sitelibdir = $(sitedir)/$(ruby_version)
|
|
37
|
-
sitedir = $(rubylibprefix)/site_ruby
|
|
38
|
-
rubyarchdir = $(rubylibdir)/$(arch)
|
|
39
|
-
rubylibdir = $(rubylibprefix)/$(ruby_version)
|
|
40
|
-
sitearchincludedir = $(includedir)/$(sitearch)
|
|
41
|
-
archincludedir = $(includedir)/$(arch)
|
|
42
|
-
sitearchlibdir = $(libdir)/$(sitearch)
|
|
43
|
-
archlibdir = $(libdir)/$(arch)
|
|
44
|
-
ridir = $(datarootdir)/$(RI_BASE_NAME)
|
|
45
|
-
modular_gc_dir = $(DESTDIR)
|
|
46
|
-
mandir = $(datarootdir)/man
|
|
47
|
-
localedir = $(datarootdir)/locale
|
|
48
|
-
libdir = $(exec_prefix)/lib
|
|
49
|
-
psdir = $(docdir)
|
|
50
|
-
pdfdir = $(docdir)
|
|
51
|
-
dvidir = $(docdir)
|
|
52
|
-
htmldir = $(docdir)
|
|
53
|
-
infodir = $(datarootdir)/info
|
|
54
|
-
docdir = $(datarootdir)/doc/$(PACKAGE)
|
|
55
|
-
oldincludedir = $(DESTDIR)/usr/include
|
|
56
|
-
includedir = $(SDKROOT)$(prefix)/include
|
|
57
|
-
runstatedir = $(localstatedir)/run
|
|
58
|
-
localstatedir = $(prefix)/var
|
|
59
|
-
sharedstatedir = $(prefix)/com
|
|
60
|
-
sysconfdir = $(prefix)/etc
|
|
61
|
-
datadir = $(datarootdir)
|
|
62
|
-
datarootdir = $(prefix)/share
|
|
63
|
-
libexecdir = $(exec_prefix)/libexec
|
|
64
|
-
sbindir = $(exec_prefix)/sbin
|
|
65
|
-
bindir = $(exec_prefix)/bin
|
|
66
|
-
archdir = $(rubyarchdir)
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
CC_WRAPPER =
|
|
70
|
-
CC = clang
|
|
71
|
-
CXX = clang++ -std=gnu++11
|
|
72
|
-
LIBRUBY = $(LIBRUBY_A)
|
|
73
|
-
LIBRUBY_A = lib$(RUBY_SO_NAME)-static.a
|
|
74
|
-
LIBRUBYARG_SHARED =
|
|
75
|
-
LIBRUBYARG_STATIC = -l$(RUBY_SO_NAME)-static -framework CoreFoundation $(MAINLIBS)
|
|
76
|
-
empty =
|
|
77
|
-
OUTFLAG = -o $(empty)
|
|
78
|
-
COUTFLAG = -o $(empty)
|
|
79
|
-
CSRCFLAG = $(empty)
|
|
80
|
-
|
|
81
|
-
RUBY_EXTCONF_H = extconf.h
|
|
82
|
-
cflags = $(hardenflags) -fdeclspec $(optflags) $(debugflags) $(warnflags)
|
|
83
|
-
cxxflags =
|
|
84
|
-
optflags = -O3 -fno-fast-math
|
|
85
|
-
debugflags = -ggdb3
|
|
86
|
-
warnflags = -Wall -Wextra -Wextra-tokens -Wdeprecated-declarations -Wdivision-by-zero -Wdiv-by-zero -Wimplicit-function-declaration -Wimplicit-int -Wpointer-arith -Wshorten-64-to-32 -Wwrite-strings -Wold-style-definition -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wunused-variable -Wmisleading-indentation -Wundef
|
|
87
|
-
cppflags =
|
|
88
|
-
CCDLFLAGS = -fno-common
|
|
89
|
-
CFLAGS = $(CCDLFLAGS) $(cflags) -pipe -Wall -Wno-unknown-pragmas -std=c99 $(ARCH_FLAG)
|
|
90
|
-
INCFLAGS = -I. -I$(arch_hdrdir) -I$(hdrdir)/ruby/backward -I$(hdrdir) -I$(srcdir)
|
|
91
|
-
DEFS =
|
|
92
|
-
CPPFLAGS = -DRUBY_EXTCONF_H=\"$(RUBY_EXTCONF_H)\" -I/opt/local/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT $(DEFS) $(cppflags)
|
|
93
|
-
CXXFLAGS = $(CCDLFLAGS) -fdeclspec $(ARCH_FLAG)
|
|
94
|
-
ldflags = -L. -fstack-protector-strong -L/opt/local/lib
|
|
95
|
-
dldflags = -L/opt/local/lib -Wl,-undefined,dynamic_lookup -bundle_loader '$(BUILTRUBY)'
|
|
96
|
-
ARCH_FLAG = -arch arm64
|
|
97
|
-
DLDFLAGS = $(ldflags) $(dldflags) $(ARCH_FLAG)
|
|
98
|
-
LDSHARED = $(CC) -dynamic -bundle
|
|
99
|
-
LDSHAREDXX = $(CXX) -dynamic -bundle
|
|
100
|
-
POSTLINK = dsymutil $@ 2>/dev/null; { test -z '$(RUBY_CODESIGN)' || codesign -s '$(RUBY_CODESIGN)' $@; }
|
|
101
|
-
AR = ar
|
|
102
|
-
LD = ld
|
|
103
|
-
EXEEXT =
|
|
104
|
-
|
|
105
|
-
RUBY_INSTALL_NAME = $(RUBY_BASE_NAME)
|
|
106
|
-
RUBY_SO_NAME = ruby.3.4
|
|
107
|
-
RUBYW_INSTALL_NAME =
|
|
108
|
-
RUBY_VERSION_NAME = $(RUBY_BASE_NAME)-$(ruby_version)
|
|
109
|
-
RUBYW_BASE_NAME = rubyw
|
|
110
|
-
RUBY_BASE_NAME = ruby
|
|
111
|
-
|
|
112
|
-
arch = arm64-darwin24
|
|
113
|
-
sitearch = $(arch)
|
|
114
|
-
ruby_version = 3.4.0
|
|
115
|
-
ruby = $(bindir)/$(RUBY_BASE_NAME)
|
|
116
|
-
RUBY = $(ruby)
|
|
117
|
-
BUILTRUBY = $(bindir)/$(RUBY_BASE_NAME)
|
|
118
|
-
ruby_headers = $(hdrdir)/ruby.h $(hdrdir)/ruby/backward.h $(hdrdir)/ruby/ruby.h $(hdrdir)/ruby/defines.h $(hdrdir)/ruby/missing.h $(hdrdir)/ruby/intern.h $(hdrdir)/ruby/st.h $(hdrdir)/ruby/subst.h $(arch_hdrdir)/ruby/config.h $(RUBY_EXTCONF_H)
|
|
119
|
-
|
|
120
|
-
RM = rm -f
|
|
121
|
-
RM_RF = rm -fr
|
|
122
|
-
RMDIRS = rmdir -p
|
|
123
|
-
MAKEDIRS = /opt/local/bin/gmkdir -p
|
|
124
|
-
INSTALL = /opt/local/bin/ginstall -c
|
|
125
|
-
INSTALL_PROG = $(INSTALL) -m 0755
|
|
126
|
-
INSTALL_DATA = $(INSTALL) -m 644
|
|
127
|
-
COPY = cp
|
|
128
|
-
TOUCH = exit >
|
|
129
|
-
|
|
130
|
-
#### End of system configuration section. ####
|
|
131
|
-
|
|
132
|
-
preload =
|
|
133
|
-
libpath = . $(libdir) /opt/local/lib
|
|
134
|
-
LIBPATH = -L. -L$(libdir) -L/opt/local/lib
|
|
135
|
-
DEFFILE =
|
|
136
|
-
|
|
137
|
-
CLEANFILES = mkmf.log
|
|
138
|
-
DISTCLEANFILES =
|
|
139
|
-
DISTCLEANDIRS =
|
|
140
|
-
|
|
141
|
-
extout =
|
|
142
|
-
extout_prefix =
|
|
143
|
-
target_prefix =
|
|
144
|
-
LOCAL_LIBS =
|
|
145
|
-
LIBS = -lpthread
|
|
146
|
-
ORIG_SRCS =
|
|
147
|
-
SRCS = $(ORIG_SRCS) profiler.c time.c fiber.c capture.c
|
|
148
|
-
OBJS = profiler.o time.o fiber.o capture.o
|
|
149
|
-
HDRS = $(srcdir)/extconf.h
|
|
150
|
-
LOCAL_HDRS =
|
|
151
|
-
TARGET = Fiber_Profiler
|
|
152
|
-
TARGET_NAME = Fiber_Profiler
|
|
153
|
-
TARGET_ENTRY = Init_$(TARGET_NAME)
|
|
154
|
-
DLLIB = $(TARGET).bundle
|
|
155
|
-
EXTSTATIC =
|
|
156
|
-
STATIC_LIB =
|
|
157
|
-
|
|
158
|
-
TIMESTAMP_DIR = .
|
|
159
|
-
BINDIR = $(bindir)
|
|
160
|
-
RUBYCOMMONDIR = $(sitedir)$(target_prefix)
|
|
161
|
-
RUBYLIBDIR = $(sitelibdir)$(target_prefix)
|
|
162
|
-
RUBYARCHDIR = $(sitearchdir)$(target_prefix)
|
|
163
|
-
HDRDIR = $(sitehdrdir)$(target_prefix)
|
|
164
|
-
ARCHHDRDIR = $(sitearchhdrdir)$(target_prefix)
|
|
165
|
-
TARGET_SO_DIR =
|
|
166
|
-
TARGET_SO = $(TARGET_SO_DIR)$(DLLIB)
|
|
167
|
-
CLEANLIBS = $(TARGET_SO) $(TARGET_SO:=.dSYM)
|
|
168
|
-
CLEANOBJS = $(OBJS) *.bak
|
|
169
|
-
TARGET_SO_DIR_TIMESTAMP = $(TIMESTAMP_DIR)/.sitearchdir.time
|
|
170
|
-
|
|
171
|
-
all: $(DLLIB)
|
|
172
|
-
static: $(STATIC_LIB)
|
|
173
|
-
.PHONY: all install static install-so install-rb
|
|
174
|
-
.PHONY: clean clean-so clean-static clean-rb
|
|
175
|
-
|
|
176
|
-
clean-static::
|
|
177
|
-
clean-rb-default::
|
|
178
|
-
clean-rb::
|
|
179
|
-
clean-so::
|
|
180
|
-
clean: clean-so clean-static clean-rb-default clean-rb
|
|
181
|
-
-$(Q)$(RM_RF) $(CLEANLIBS) $(CLEANOBJS) $(CLEANFILES) .*.time
|
|
182
|
-
|
|
183
|
-
distclean-rb-default::
|
|
184
|
-
distclean-rb::
|
|
185
|
-
distclean-so::
|
|
186
|
-
distclean-static::
|
|
187
|
-
distclean: clean distclean-so distclean-static distclean-rb-default distclean-rb
|
|
188
|
-
-$(Q)$(RM) Makefile $(RUBY_EXTCONF_H) conftest.* mkmf.log
|
|
189
|
-
-$(Q)$(RM) core ruby$(EXEEXT) *~ $(DISTCLEANFILES)
|
|
190
|
-
-$(Q)$(RMDIRS) $(DISTCLEANDIRS) 2> /dev/null || true
|
|
191
|
-
|
|
192
|
-
realclean: distclean
|
|
193
|
-
install: install-so install-rb
|
|
194
|
-
|
|
195
|
-
install-so: $(DLLIB) $(TARGET_SO_DIR_TIMESTAMP)
|
|
196
|
-
$(INSTALL_PROG) $(DLLIB) $(RUBYARCHDIR)
|
|
197
|
-
clean-static::
|
|
198
|
-
-$(Q)$(RM) $(STATIC_LIB)
|
|
199
|
-
install-rb: pre-install-rb do-install-rb install-rb-default
|
|
200
|
-
install-rb-default: pre-install-rb-default do-install-rb-default
|
|
201
|
-
pre-install-rb: Makefile
|
|
202
|
-
pre-install-rb-default: Makefile
|
|
203
|
-
do-install-rb:
|
|
204
|
-
do-install-rb-default:
|
|
205
|
-
pre-install-rb-default:
|
|
206
|
-
@$(NULLCMD)
|
|
207
|
-
$(TARGET_SO_DIR_TIMESTAMP):
|
|
208
|
-
$(Q) $(MAKEDIRS) $(@D) $(RUBYARCHDIR)
|
|
209
|
-
$(Q) $(TOUCH) $@
|
|
210
|
-
|
|
211
|
-
site-install: site-install-so site-install-rb
|
|
212
|
-
site-install-so: install-so
|
|
213
|
-
site-install-rb: install-rb
|
|
214
|
-
|
|
215
|
-
.SUFFIXES: .c .m .cc .mm .cxx .cpp .o .S
|
|
216
|
-
|
|
217
|
-
.cc.o:
|
|
218
|
-
$(ECHO) compiling $(<)
|
|
219
|
-
$(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $(CSRCFLAG)$<
|
|
220
|
-
|
|
221
|
-
.cc.S:
|
|
222
|
-
$(ECHO) translating $(<)
|
|
223
|
-
$(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -S $(CSRCFLAG)$<
|
|
224
|
-
|
|
225
|
-
.mm.o:
|
|
226
|
-
$(ECHO) compiling $(<)
|
|
227
|
-
$(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $(CSRCFLAG)$<
|
|
228
|
-
|
|
229
|
-
.mm.S:
|
|
230
|
-
$(ECHO) translating $(<)
|
|
231
|
-
$(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -S $(CSRCFLAG)$<
|
|
232
|
-
|
|
233
|
-
.cxx.o:
|
|
234
|
-
$(ECHO) compiling $(<)
|
|
235
|
-
$(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $(CSRCFLAG)$<
|
|
236
|
-
|
|
237
|
-
.cxx.S:
|
|
238
|
-
$(ECHO) translating $(<)
|
|
239
|
-
$(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -S $(CSRCFLAG)$<
|
|
240
|
-
|
|
241
|
-
.cpp.o:
|
|
242
|
-
$(ECHO) compiling $(<)
|
|
243
|
-
$(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $(CSRCFLAG)$<
|
|
244
|
-
|
|
245
|
-
.cpp.S:
|
|
246
|
-
$(ECHO) translating $(<)
|
|
247
|
-
$(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -S $(CSRCFLAG)$<
|
|
248
|
-
|
|
249
|
-
.c.o:
|
|
250
|
-
$(ECHO) compiling $(<)
|
|
251
|
-
$(Q) $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) $(COUTFLAG)$@ -c $(CSRCFLAG)$<
|
|
252
|
-
|
|
253
|
-
.c.S:
|
|
254
|
-
$(ECHO) translating $(<)
|
|
255
|
-
$(Q) $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) $(COUTFLAG)$@ -S $(CSRCFLAG)$<
|
|
256
|
-
|
|
257
|
-
.m.o:
|
|
258
|
-
$(ECHO) compiling $(<)
|
|
259
|
-
$(Q) $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) $(COUTFLAG)$@ -c $(CSRCFLAG)$<
|
|
260
|
-
|
|
261
|
-
.m.S:
|
|
262
|
-
$(ECHO) translating $(<)
|
|
263
|
-
$(Q) $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) $(COUTFLAG)$@ -S $(CSRCFLAG)$<
|
|
264
|
-
|
|
265
|
-
$(TARGET_SO): $(OBJS) Makefile
|
|
266
|
-
$(ECHO) linking shared-object $(DLLIB)
|
|
267
|
-
-$(Q)$(RM) $(@)
|
|
268
|
-
$(Q) $(LDSHARED) -o $@ $(OBJS) $(LIBPATH) $(DLDFLAGS) $(LOCAL_LIBS) $(LIBS)
|
|
269
|
-
$(Q) $(POSTLINK)
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
$(OBJS): $(HDRS) $(ruby_headers)
|
data/ext/capture.o
DELETED
|
Binary file
|
data/ext/extconf.h
DELETED
data/ext/fiber.o
DELETED
|
Binary file
|
data/ext/mkmf.log
DELETED
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
have_func: checking for rb_fiber_current()... -------------------- yes
|
|
2
|
-
|
|
3
|
-
DYLD_LIBRARY_PATH=.:/Users/samuel/.rubies/ruby-3.4.1/lib ASAN_OPTIONS=detect_leaks=0 "clang -o conftest -I/Users/samuel/.rubies/ruby-3.4.1/include/ruby-3.4.0/arm64-darwin24 -I/Users/samuel/.rubies/ruby-3.4.1/include/ruby-3.4.0/ruby/backward -I/Users/samuel/.rubies/ruby-3.4.1/include/ruby-3.4.0 -I. -I/opt/local/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -fstack-protector-strong -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fdeclspec -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wextra-tokens -Wdeprecated-declarations -Wdivision-by-zero -Wdiv-by-zero -Wimplicit-function-declaration -Wimplicit-int -Wpointer-arith -Wshorten-64-to-32 -Wwrite-strings -Wold-style-definition -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wunused-variable -Wmisleading-indentation -Wundef -pipe -Wall -Wno-unknown-pragmas -std=c99 conftest.c -L. -L/Users/samuel/.rubies/ruby-3.4.1/lib -L/opt/local/lib -L. -fstack-protector-strong -L/opt/local/lib -arch arm64 -lruby.3.4-static -framework CoreFoundation -lgmp -ldl -lobjc -lpthread -lpthread "
|
|
4
|
-
ld: warning: ignoring duplicate libraries: '-lpthread'
|
|
5
|
-
checked program was:
|
|
6
|
-
/* begin */
|
|
7
|
-
1: #include "ruby.h"
|
|
8
|
-
2:
|
|
9
|
-
3: int main(int argc, char **argv)
|
|
10
|
-
4: {
|
|
11
|
-
5: return !!argv[argc];
|
|
12
|
-
6: }
|
|
13
|
-
/* end */
|
|
14
|
-
|
|
15
|
-
DYLD_LIBRARY_PATH=.:/Users/samuel/.rubies/ruby-3.4.1/lib ASAN_OPTIONS=detect_leaks=0 "clang -o conftest -I/Users/samuel/.rubies/ruby-3.4.1/include/ruby-3.4.0/arm64-darwin24 -I/Users/samuel/.rubies/ruby-3.4.1/include/ruby-3.4.0/ruby/backward -I/Users/samuel/.rubies/ruby-3.4.1/include/ruby-3.4.0 -I. -I/opt/local/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -fstack-protector-strong -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fdeclspec -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wextra-tokens -Wdeprecated-declarations -Wdivision-by-zero -Wdiv-by-zero -Wimplicit-function-declaration -Wimplicit-int -Wpointer-arith -Wshorten-64-to-32 -Wwrite-strings -Wold-style-definition -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wunused-variable -Wmisleading-indentation -Wundef -pipe -Wall -Wno-unknown-pragmas -std=c99 conftest.c -L. -L/Users/samuel/.rubies/ruby-3.4.1/lib -L/opt/local/lib -L. -fstack-protector-strong -L/opt/local/lib -arch arm64 -lruby.3.4-static -framework CoreFoundation -lgmp -ldl -lobjc -lpthread -lpthread "
|
|
16
|
-
ld: warning: ignoring duplicate libraries: '-lpthread'
|
|
17
|
-
checked program was:
|
|
18
|
-
/* begin */
|
|
19
|
-
1: #include "ruby.h"
|
|
20
|
-
2:
|
|
21
|
-
3: /*top*/
|
|
22
|
-
4: extern int t(void);
|
|
23
|
-
5: int main(int argc, char **argv)
|
|
24
|
-
6: {
|
|
25
|
-
7: if (argc > 1000000) {
|
|
26
|
-
8: int (* volatile tp)(void)=(int (*)(void))&t;
|
|
27
|
-
9: printf("%d", (*tp)());
|
|
28
|
-
10: }
|
|
29
|
-
11:
|
|
30
|
-
12: return !!argv[argc];
|
|
31
|
-
13: }
|
|
32
|
-
14: int t(void) { void ((*volatile p)()); p = (void ((*)()))rb_fiber_current; return !p; }
|
|
33
|
-
/* end */
|
|
34
|
-
|
|
35
|
-
--------------------
|
|
36
|
-
|
|
37
|
-
have_func: checking for rb_ext_ractor_safe()... -------------------- yes
|
|
38
|
-
|
|
39
|
-
DYLD_LIBRARY_PATH=.:/Users/samuel/.rubies/ruby-3.4.1/lib ASAN_OPTIONS=detect_leaks=0 "clang -o conftest -I/Users/samuel/.rubies/ruby-3.4.1/include/ruby-3.4.0/arm64-darwin24 -I/Users/samuel/.rubies/ruby-3.4.1/include/ruby-3.4.0/ruby/backward -I/Users/samuel/.rubies/ruby-3.4.1/include/ruby-3.4.0 -I. -I/opt/local/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -fstack-protector-strong -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fdeclspec -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wextra-tokens -Wdeprecated-declarations -Wdivision-by-zero -Wdiv-by-zero -Wimplicit-function-declaration -Wimplicit-int -Wpointer-arith -Wshorten-64-to-32 -Wwrite-strings -Wold-style-definition -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wunused-variable -Wmisleading-indentation -Wundef -pipe -Wall -Wno-unknown-pragmas -std=c99 conftest.c -L. -L/Users/samuel/.rubies/ruby-3.4.1/lib -L/opt/local/lib -L. -fstack-protector-strong -L/opt/local/lib -arch arm64 -lruby.3.4-static -framework CoreFoundation -lgmp -ldl -lobjc -lpthread -lpthread "
|
|
40
|
-
ld: warning: ignoring duplicate libraries: '-lpthread'
|
|
41
|
-
checked program was:
|
|
42
|
-
/* begin */
|
|
43
|
-
1: #include "ruby.h"
|
|
44
|
-
2:
|
|
45
|
-
3: /*top*/
|
|
46
|
-
4: extern int t(void);
|
|
47
|
-
5: int main(int argc, char **argv)
|
|
48
|
-
6: {
|
|
49
|
-
7: if (argc > 1000000) {
|
|
50
|
-
8: int (* volatile tp)(void)=(int (*)(void))&t;
|
|
51
|
-
9: printf("%d", (*tp)());
|
|
52
|
-
10: }
|
|
53
|
-
11:
|
|
54
|
-
12: return !!argv[argc];
|
|
55
|
-
13: }
|
|
56
|
-
14: int t(void) { void ((*volatile p)()); p = (void ((*)()))rb_ext_ractor_safe; return !p; }
|
|
57
|
-
/* end */
|
|
58
|
-
|
|
59
|
-
--------------------
|
|
60
|
-
|
|
61
|
-
extconf.h is:
|
|
62
|
-
/* begin */
|
|
63
|
-
1: #ifndef EXTCONF_H
|
|
64
|
-
2: #define EXTCONF_H
|
|
65
|
-
3: #define HAVE_RB_FIBER_CURRENT 1
|
|
66
|
-
4: #define HAVE_RB_EXT_RACTOR_SAFE 1
|
|
67
|
-
5: #endif
|
|
68
|
-
/* end */
|
|
69
|
-
|
data/ext/profiler.o
DELETED
|
Binary file
|
data/ext/time.o
DELETED
|
Binary file
|