heap_dump 0.0.10 → 0.0.11
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +2 -0
- data/ext/heap_dump/heap_dump.c +129 -0
- data/lib/heap_dump/version.rb +1 -1
- metadata +8 -8
data/README.md
CHANGED
@@ -80,6 +80,8 @@ Format is not stable yet, but looks like this:
|
|
80
80
|
,{"id":70365602717060,"bt":"T_DATA","type_name":"proc","size":72,"is_lambda":0,"blockprocval":null,"envval":70365602712440,"iseq":{"id":70365600821896,"name":"block in <class:FileList>","filename":"/Users/vasfed/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/file_list.rb","line":743,"type":"block","refs_array_id":70365611724600,"coverage":null,"klass":null,"cref_stack":70365611799480,"defined_method_id":0}}
|
81
81
|
,{"id":70365603045160,"bt":"T_DATA","type_name":"VM/env","size":128,"refs":[]}
|
82
82
|
,{"id":70365613258980,"bt":"T_ICLASS","name":"Object","methods":{"==":"(CFUNC)",">":"(CFUNC)",">=":"(CFUNC)","<":"(CFUNC)","<=":"(CFUNC)","between?":"(CFUNC)"},"ivs":{"__classid__":"Comparable"},"super":70365613259120}
|
83
|
+
,{"id":70151795145340,"bt":"T_DATA","type_name":"proc","size":72,"is_lambda":0,"blockprocval":null,"envval":70151795224840,"iseq":{"id":70151828020360,"name":"block in subscribe","filename":"/Users/vasfed/acceptor.rb","line":91,"type":"block","refs_array_id":70151796420080,"coverage":null,"klass":null,"cref_stack":70151796421080,"defined_method_id":0}}
|
84
|
+
,{"id":70151795224840,"bt":"T_DATA","type_name":"VM/env","size":120,"refs":[70151806738200,70151796176180,"string1",null,0,70151795224840,null]}
|
83
85
|
]
|
84
86
|
```
|
85
87
|
etc.
|
data/ext/heap_dump/heap_dump.c
CHANGED
@@ -535,6 +535,7 @@ static void dump_data_if_known(VALUE obj, walk_ctx_t *ctx){
|
|
535
535
|
// proc <-
|
536
536
|
// thgroup
|
537
537
|
// time
|
538
|
+
// etc...
|
538
539
|
|
539
540
|
const char* typename = RTYPEDDATA_TYPE(obj)->wrap_struct_name;
|
540
541
|
|
@@ -603,6 +604,134 @@ static void dump_data_if_known(VALUE obj, walk_ctx_t *ctx){
|
|
603
604
|
return;
|
604
605
|
}
|
605
606
|
|
607
|
+
if(!strcmp("VM", typename)){
|
608
|
+
const rb_vm_t *vm = RTYPEDDATA_DATA(obj);
|
609
|
+
|
610
|
+
ygh_id("thgroup_default", vm->thgroup_default);
|
611
|
+
ygh_id("mark_object_ary", vm->mark_object_ary);
|
612
|
+
ygh_id("load_path", vm->load_path);
|
613
|
+
ygh_id("loaded_features", vm->loaded_features);
|
614
|
+
ygh_id("top_self", vm->top_self);
|
615
|
+
ygh_id("coverages", vm->coverages);
|
616
|
+
|
617
|
+
//TODO:
|
618
|
+
// if (vm->living_threads) {
|
619
|
+
// st_foreach(vm->living_threads, vm_mark_each_thread_func, 0);
|
620
|
+
// }
|
621
|
+
// rb_gc_mark_locations(vm->special_exceptions, vm->special_exceptions + ruby_special_error_count);
|
622
|
+
|
623
|
+
// if (vm->loading_table) {
|
624
|
+
// rb_mark_tbl(vm->loading_table);
|
625
|
+
// }
|
626
|
+
|
627
|
+
// mark_event_hooks(vm->event_hooks);
|
628
|
+
|
629
|
+
// for (i = 0; i < RUBY_NSIG; i++) {
|
630
|
+
// if (vm->trap_list[i].cmd)
|
631
|
+
// rb_gc_mark(vm->trap_list[i].cmd);
|
632
|
+
// }
|
633
|
+
// }
|
634
|
+
return;
|
635
|
+
}
|
636
|
+
|
637
|
+
if(!strcmp("VM/thread", typename)){
|
638
|
+
const rb_thread_t *th = RTYPEDDATA_DATA(obj);
|
639
|
+
if(th->stack){
|
640
|
+
VALUE *p = th->stack;
|
641
|
+
VALUE *sp = th->cfp->sp;
|
642
|
+
rb_control_frame_t *cfp = th->cfp;
|
643
|
+
rb_control_frame_t *limit_cfp = (void *)(th->stack + th->stack_size);
|
644
|
+
|
645
|
+
yg_cstring("stack");
|
646
|
+
yajl_gen_array_open(ctx->yajl);
|
647
|
+
while (p < sp) yg_id(*p++);
|
648
|
+
yajl_gen_array_close(ctx->yajl);
|
649
|
+
|
650
|
+
yg_cstring("cfp");
|
651
|
+
yajl_gen_array_open(ctx->yajl);
|
652
|
+
while (cfp != limit_cfp) {
|
653
|
+
yajl_gen_map_open(ctx->yajl);
|
654
|
+
rb_iseq_t *iseq = cfp->iseq;
|
655
|
+
ygh_id("proc", cfp->proc);
|
656
|
+
ygh_id("self", cfp->self);
|
657
|
+
if (iseq) {
|
658
|
+
ygh_id("iseq", RUBY_VM_NORMAL_ISEQ_P(iseq) ? iseq->self : (VALUE)iseq);
|
659
|
+
int line_no = rb_vm_get_sourceline(cfp);
|
660
|
+
ygh_rstring("file", iseq->filename);
|
661
|
+
ygh_int("line_no",line_no);
|
662
|
+
}
|
663
|
+
if (cfp->me){
|
664
|
+
const rb_method_entry_t *me = cfp->me;
|
665
|
+
//((rb_method_entry_t *)cfp->me)->mark = 1;
|
666
|
+
yg_cstring("me");
|
667
|
+
yajl_gen_map_open(ctx->yajl);
|
668
|
+
//
|
669
|
+
//rb_method_flag_t flag;
|
670
|
+
// char mark;
|
671
|
+
//rb_method_definition_t *def;
|
672
|
+
ygh_id("klass", me->klass);
|
673
|
+
ID id = me->called_id;
|
674
|
+
|
675
|
+
if(me->def){
|
676
|
+
id = me->def->original_id;
|
677
|
+
yg_cstring("def");
|
678
|
+
dump_method_definition_as_value(me->def, ctx);
|
679
|
+
}
|
680
|
+
if(id != ID_ALLOCATOR)
|
681
|
+
ygh_rstring("meth_id", rb_id2str(id));
|
682
|
+
yajl_gen_map_close(ctx->yajl);
|
683
|
+
}
|
684
|
+
cfp = RUBY_VM_PREVIOUS_CONTROL_FRAME(cfp);
|
685
|
+
yajl_gen_map_close(ctx->yajl);
|
686
|
+
}
|
687
|
+
yajl_gen_array_close(ctx->yajl);
|
688
|
+
}
|
689
|
+
|
690
|
+
//TODO: mark other...
|
691
|
+
ygh_id("first_proc", th->first_proc);
|
692
|
+
if (th->first_proc) ygh_id("first_proc", th->first_args);
|
693
|
+
|
694
|
+
ygh_id("thgroup", th->thgroup);
|
695
|
+
ygh_id("value", th->value);
|
696
|
+
ygh_id("errinfo", th->errinfo);
|
697
|
+
ygh_id("thrown_errinfo", th->thrown_errinfo);
|
698
|
+
ygh_id("local_svar", th->local_svar);
|
699
|
+
ygh_id("top_self", th->top_self);
|
700
|
+
ygh_id("top_wrapper", th->top_wrapper);
|
701
|
+
ygh_id("fiber", th->fiber);
|
702
|
+
ygh_id("root_fiber", th->root_fiber);
|
703
|
+
ygh_id("stat_insn_usage", th->stat_insn_usage);
|
704
|
+
ygh_id("last_status", th->last_status);
|
705
|
+
ygh_id("locking_mutex", th->locking_mutex);
|
706
|
+
|
707
|
+
// rb_mark_tbl(th->local_storage);
|
708
|
+
|
709
|
+
// if (GET_THREAD() != th && th->machine_stack_start && th->machine_stack_end) {
|
710
|
+
// rb_gc_mark_machine_stack(th);
|
711
|
+
// rb_gc_mark_locations((VALUE *)&th->machine_regs,
|
712
|
+
// (VALUE *)(&th->machine_regs) +
|
713
|
+
// sizeof(th->machine_regs) / sizeof(VALUE));
|
714
|
+
// }
|
715
|
+
|
716
|
+
// mark_event_hooks(th->event_hooks);
|
717
|
+
|
718
|
+
return;
|
719
|
+
}
|
720
|
+
|
721
|
+
//FIXME: autogen this from ruby (this copied from 1.9.2p290)
|
722
|
+
struct thgroup {
|
723
|
+
int enclosed;
|
724
|
+
VALUE group;
|
725
|
+
};
|
726
|
+
|
727
|
+
if(!strcmp("thgroup", typename)){
|
728
|
+
const struct thgroup* gr = RTYPEDDATA_DATA(obj);
|
729
|
+
ygh_id("group", gr->group);
|
730
|
+
ygh_int("enclosed", gr->enclosed);
|
731
|
+
return;
|
732
|
+
}
|
733
|
+
|
734
|
+
|
606
735
|
}
|
607
736
|
|
608
737
|
static VALUE rb_class_real_checked(VALUE cl)
|
data/lib/heap_dump/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: heap_dump
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.11
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-06-01 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: ruby-internal
|
16
|
-
requirement: &
|
16
|
+
requirement: &70360524817500 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: 0.8.5
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70360524817500
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: yajl-ruby
|
27
|
-
requirement: &
|
27
|
+
requirement: &70360524816940 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ~>
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '1.1'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70360524816940
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: rake-compiler
|
38
|
-
requirement: &
|
38
|
+
requirement: &70360524816540 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,7 +43,7 @@ dependencies:
|
|
43
43
|
version: '0'
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70360524816540
|
47
47
|
description: dump ruby 1.9 heap contents
|
48
48
|
email:
|
49
49
|
- vasilyfedoseyev@gmail.com
|