allocation_tracer 0.1.0 → 0.1.1
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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 434fc304eec817d33faa852fed47fe0313b5ac3a
|
4
|
+
data.tar.gz: ec7b3a9e1f126cfaf7cbff508b9613eb93547334
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eeb8744fbad790fada8a84f78cb83c6d58c1dd62044125a21f6770f77392c22a9d2400fa13814eaf7f6a8f76fbc8da125bb56942500a78c1e474c3333aaac6c5
|
7
|
+
data.tar.gz: 5c7baa58e8f347acd5d873112d1f9fe6ee3ce84e55b626cfbcd2d61d48c7cf10a49e10a39d6692044d549ae168ac36c70005b1108a9c1a43a947d8cdbca328f9
|
@@ -139,7 +139,7 @@ get_traceobj_arg(void)
|
|
139
139
|
tmp_trace_arg = ALLOC_N(struct traceobj_arg, 1);
|
140
140
|
tmp_trace_arg->running = 0;
|
141
141
|
tmp_trace_arg->keys = 0;
|
142
|
-
tmp_trace_arg->vals = VAL_COUNT | VAL_TOTAL_AGE | VAL_MAX_AGE | VAL_MIN_AGE | VAL_MEMSIZE;
|
142
|
+
tmp_trace_arg->vals = VAL_COUNT | VAL_OLDCOUNT | VAL_TOTAL_AGE | VAL_MAX_AGE | VAL_MIN_AGE | VAL_MEMSIZE;
|
143
143
|
tmp_trace_arg->aggregate_table = st_init_table(&memcmp_hash_type);
|
144
144
|
tmp_trace_arg->object_table = st_init_numtable();
|
145
145
|
tmp_trace_arg->str_table = st_init_strtable();
|
@@ -536,22 +536,27 @@ allocation_tracer_setup(int argc, VALUE *argv, VALUE self)
|
|
536
536
|
rb_raise(rb_eRuntimeError, "can't change configuration during running");
|
537
537
|
}
|
538
538
|
else {
|
539
|
-
|
540
|
-
|
541
|
-
|
542
|
-
|
543
|
-
|
544
|
-
|
545
|
-
|
546
|
-
|
547
|
-
|
548
|
-
|
549
|
-
|
550
|
-
|
539
|
+
if (argc >= 1) {
|
540
|
+
int i;
|
541
|
+
VALUE ary = rb_check_array_type(argv[0]);
|
542
|
+
|
543
|
+
arg->keys = 0;
|
544
|
+
|
545
|
+
for (i=0; i<(int)RARRAY_LEN(ary); i++) {
|
546
|
+
if (RARRAY_AREF(ary, i) == ID2SYM(rb_intern("path"))) arg->keys |= KEY_PATH;
|
547
|
+
else if (RARRAY_AREF(ary, i) == ID2SYM(rb_intern("line"))) arg->keys |= KEY_LINE;
|
548
|
+
else if (RARRAY_AREF(ary, i) == ID2SYM(rb_intern("type"))) arg->keys |= KEY_TYPE;
|
549
|
+
else if (RARRAY_AREF(ary, i) == ID2SYM(rb_intern("class"))) arg->keys |= KEY_CLASS;
|
550
|
+
else {
|
551
|
+
rb_raise(rb_eArgError, "not supported key type");
|
552
|
+
}
|
551
553
|
}
|
552
554
|
}
|
553
555
|
}
|
554
556
|
|
557
|
+
if (argc == 0) {
|
558
|
+
arg->keys = KEY_PATH | KEY_LINE;
|
559
|
+
}
|
555
560
|
return Qnil;
|
556
561
|
}
|
557
562
|
|
Binary file
|
@@ -82,6 +82,20 @@ describe ObjectSpace::AllocationTracer do
|
|
82
82
|
expect(result[[__FILE__, line + 1, Object]]).to eq [1, 0, 0, 0, 0, 0]
|
83
83
|
expect(result[[__FILE__, line + 1, String]]).to eq [1, 0, 0, 0, 0, 0]
|
84
84
|
end
|
85
|
+
|
86
|
+
it 'should have correct headers' do
|
87
|
+
ObjectSpace::AllocationTracer.setup(%i(path line))
|
88
|
+
expect(ObjectSpace::AllocationTracer.header).to eq [:path, :line, :count, :old_count, :total_age, :min_age, :max_age, :total_memsize]
|
89
|
+
ObjectSpace::AllocationTracer.setup(%i(path line class))
|
90
|
+
expect(ObjectSpace::AllocationTracer.header).to eq [:path, :line, :class, :count, :old_count, :total_age, :min_age, :max_age, :total_memsize]
|
91
|
+
ObjectSpace::AllocationTracer.setup(%i(path line type class))
|
92
|
+
expect(ObjectSpace::AllocationTracer.header).to eq [:path, :line, :type, :class, :count, :old_count, :total_age, :min_age, :max_age, :total_memsize]
|
93
|
+
end
|
94
|
+
|
95
|
+
it 'should set default setup' do
|
96
|
+
ObjectSpace::AllocationTracer.setup()
|
97
|
+
expect(ObjectSpace::AllocationTracer.header).to eq [:path, :line, :count, :old_count, :total_age, :min_age, :max_age, :total_memsize]
|
98
|
+
end
|
85
99
|
end
|
86
100
|
end
|
87
101
|
end
|