gc_tracer 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +6 -3
- data/ext/gc_tracer/extconf.rb +2 -0
- data/ext/gc_tracer/gc_tracer.c +37 -10
- data/lib/gc_tracer/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8dc2c6bb5c46aff59932491cfdff071e7bd7f906
|
4
|
+
data.tar.gz: 44ed09676b1e928032b034060f00e17efa5c96c0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e1ed113ec6986087c61ab8460925bab0bb20a14731e2954ec94d43c1f84eb56b2476f72a2ab0a7ceb073471093887b0cabb3223655f8ecc88b7c134adfcd689c
|
7
|
+
data.tar.gz: 2c1cc72df37053edb0b610678f0587ccd5142121ae2232742ab978c843040f513573ed6c122b28ef61c6e7f0097fbd874bf18497e4c78287a68ce9d007aac7e0
|
data/README.md
CHANGED
@@ -40,9 +40,12 @@ This code is equivalent to the following code.
|
|
40
40
|
|
41
41
|
```ruby
|
42
42
|
require 'gc_tracer'
|
43
|
-
|
44
|
-
|
45
|
-
|
43
|
+
begin
|
44
|
+
GC::Tracer.start_logging(filename)
|
45
|
+
# do something
|
46
|
+
ensure
|
47
|
+
GC::Tracer.stop_logging
|
48
|
+
end
|
46
49
|
```
|
47
50
|
|
48
51
|
In the stored file (filename), you can get tab separated values of:
|
data/ext/gc_tracer/extconf.rb
CHANGED
data/ext/gc_tracer/gc_tracer.c
CHANGED
@@ -543,28 +543,49 @@ categorical_color20(int n)
|
|
543
543
|
|
544
544
|
static struct picker_description object_age_picker_description[] = {
|
545
545
|
{"empty slot", 0},
|
546
|
-
{"
|
546
|
+
{"infant slot", 0x1f77b4},
|
547
547
|
{"young slot", 0xff7f0e},
|
548
|
-
{"
|
548
|
+
{"old slot", 0x2ca02c},
|
549
|
+
{"shady slot", 0xd62728}
|
549
550
|
};
|
550
551
|
|
552
|
+
#ifdef HAVE_RB_OBJ_GC_FLAGS
|
553
|
+
size_t rb_obj_gc_flags(VALUE obj, ID* flags, size_t max);
|
554
|
+
static ID id_young;
|
555
|
+
#endif
|
556
|
+
|
551
557
|
static int
|
552
558
|
object_age_picker(VALUE v) {
|
553
559
|
if (RB_TYPE_P(v, T_NONE)) {
|
554
560
|
return 0;
|
555
561
|
}
|
556
562
|
else {
|
557
|
-
if (OBJ_PROMOTED(v)) {
|
558
|
-
|
559
|
-
|
563
|
+
if (!OBJ_PROMOTED(v)) {
|
564
|
+
if (OBJ_WB_PROTECTED(v)) {
|
565
|
+
return categorical_color10(0); /* infant */
|
566
|
+
}
|
567
|
+
else {
|
568
|
+
return categorical_color10(3); /* shady */
|
569
|
+
}
|
560
570
|
}
|
561
571
|
else {
|
562
|
-
|
563
|
-
|
564
|
-
|
572
|
+
int is_young = 0;
|
573
|
+
#ifdef HAVE_RB_OBJ_GC_FLAGS
|
574
|
+
ID ids[8];
|
575
|
+
size_t i, count = rb_obj_gc_flags(v, ids, 8);
|
576
|
+
|
577
|
+
for (i=0; i<count; i++) {
|
578
|
+
if (ids[i] == id_young) {
|
579
|
+
is_young = 1;
|
580
|
+
break;
|
581
|
+
}
|
582
|
+
}
|
583
|
+
#endif
|
584
|
+
if (is_young) {
|
585
|
+
return categorical_color10(1); /* young */
|
565
586
|
}
|
566
587
|
else {
|
567
|
-
return categorical_color10(2);
|
588
|
+
return categorical_color10(2); /* old */
|
568
589
|
}
|
569
590
|
}
|
570
591
|
}
|
@@ -817,7 +838,13 @@ Init_gc_tracer(void)
|
|
817
838
|
/* setup default banners */
|
818
839
|
setup_gc_trace_symbols();
|
819
840
|
start_tick = tick();
|
820
|
-
|
841
|
+
|
842
|
+
/* warm up */
|
843
|
+
rb_gc_latest_gc_info(ID2SYM(rb_intern("gc_by")));
|
844
|
+
#if HAVE_RB_OBJ_GC_FLAGS
|
845
|
+
rb_obj_gc_flags(rb_cObject, NULL, 0);
|
846
|
+
id_young = rb_intern("young");
|
847
|
+
#endif
|
821
848
|
|
822
849
|
gc_trace_items = rb_ary_new();
|
823
850
|
gc_trace_items_types = rb_ary_new();
|
data/lib/gc_tracer/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gc_tracer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Koichi Sasada
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-05-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|