allocation_tracer 0.3.3 → 0.4.0
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
- data/ext/allocation_tracer/allocation_tracer.c +42 -0
- data/lib/allocation_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: 94f2c93cda609ede0ad42efbd3fa6121f99e5059
|
4
|
+
data.tar.gz: a17dd435501dcce52e55fbf081201cbc80f1c724
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2a76d3201a4aed46cd935b0a6339a4138c9ba45d13f74e5228e0bc30320f68790720f29ad3ed389f21a3c24c0f382369a4966d325b23d290e163bc98b389650b
|
7
|
+
data.tar.gz: 2979c9185bb4ad81bb7b1f7cea46fbe2763ce0eec45b807f1b7b071f68a793b682a089153c2438664f35b4e4a4ca1ae01a1723a19e97beae52b1406083854433
|
@@ -24,6 +24,8 @@ struct traceobj_arg {
|
|
24
24
|
|
25
25
|
/* */
|
26
26
|
size_t **lifetime_table;
|
27
|
+
size_t allocated_count_table[T_MASK];
|
28
|
+
size_t freed_count_table[T_MASK];
|
27
29
|
};
|
28
30
|
|
29
31
|
struct allocation_info {
|
@@ -142,6 +144,7 @@ get_traceobj_arg(void)
|
|
142
144
|
{
|
143
145
|
if (tmp_trace_arg == 0) {
|
144
146
|
tmp_trace_arg = ALLOC_N(struct traceobj_arg, 1);
|
147
|
+
MEMZERO(tmp_trace_arg, struct traceobj_arg, 1);
|
145
148
|
tmp_trace_arg->running = 0;
|
146
149
|
tmp_trace_arg->keys = 0;
|
147
150
|
tmp_trace_arg->vals = VAL_COUNT | VAL_OLDCOUNT | VAL_TOTAL_AGE | VAL_MAX_AGE | VAL_MIN_AGE | VAL_MEMSIZE;
|
@@ -251,6 +254,8 @@ newobj_i(VALUE tpval, void *data)
|
|
251
254
|
info->line = NUM2INT(line);
|
252
255
|
|
253
256
|
st_insert(arg->object_table, (st_data_t)obj, (st_data_t)info);
|
257
|
+
|
258
|
+
arg->allocated_count_table[BUILTIN_TYPE(obj)]++;
|
254
259
|
}
|
255
260
|
|
256
261
|
/* file, line, type, klass */
|
@@ -395,6 +400,8 @@ freeobj_i(VALUE tpval, void *data)
|
|
395
400
|
add_lifetime_table(arg->lifetime_table, BUILTIN_TYPE(obj), info);
|
396
401
|
}
|
397
402
|
}
|
403
|
+
|
404
|
+
arg->freed_count_table[BUILTIN_TYPE(obj)]++;
|
398
405
|
}
|
399
406
|
|
400
407
|
static void
|
@@ -864,6 +871,38 @@ allocation_tracer_lifetime_table(VALUE self)
|
|
864
871
|
return result;
|
865
872
|
}
|
866
873
|
|
874
|
+
static VALUE
|
875
|
+
allocation_tracer_allocated_count_table(VALUE self)
|
876
|
+
{
|
877
|
+
struct traceobj_arg * arg = get_traceobj_arg();
|
878
|
+
VALUE h = rb_hash_new();
|
879
|
+
VALUE type;
|
880
|
+
int i;
|
881
|
+
|
882
|
+
for (i=0; i<T_MASK; i++) {
|
883
|
+
type = type_sym(i);
|
884
|
+
rb_hash_aset(h, ID2SYM(type), SIZET2NUM(arg->allocated_count_table[i]));
|
885
|
+
}
|
886
|
+
|
887
|
+
return h;
|
888
|
+
}
|
889
|
+
|
890
|
+
static VALUE
|
891
|
+
allocation_tracer_freed_count_table(VALUE self)
|
892
|
+
{
|
893
|
+
struct traceobj_arg * arg = get_traceobj_arg();
|
894
|
+
VALUE h = rb_hash_new();
|
895
|
+
VALUE type;
|
896
|
+
int i;
|
897
|
+
|
898
|
+
for (i=0; i<T_MASK; i++) {
|
899
|
+
type = type_sym(i);
|
900
|
+
rb_hash_aset(h, ID2SYM(type), SIZET2NUM(arg->freed_count_table[i]));
|
901
|
+
}
|
902
|
+
|
903
|
+
return h;
|
904
|
+
}
|
905
|
+
|
867
906
|
void
|
868
907
|
Init_allocation_tracer(void)
|
869
908
|
{
|
@@ -884,4 +923,7 @@ Init_allocation_tracer(void)
|
|
884
923
|
|
885
924
|
rb_define_module_function(mod, "lifetime_table_setup", allocation_tracer_lifetime_table_setup, 1);
|
886
925
|
rb_define_module_function(mod, "lifetime_table", allocation_tracer_lifetime_table, 0);
|
926
|
+
|
927
|
+
rb_define_module_function(mod, "allocated_count_table", allocation_tracer_allocated_count_table, 0);
|
928
|
+
rb_define_module_function(mod, "freed_count_table", allocation_tracer_freed_count_table, 0);
|
887
929
|
}
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: allocation_tracer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
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-06-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|