diff options
author | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-02-21 08:18:15 +0000 |
---|---|---|
committer | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-02-21 08:18:15 +0000 |
commit | 76c4cca19c0c27b1c3ca6f597384707cccf3de06 (patch) | |
tree | bcb13fed3f68e50cbca8a4bd475157d9bfeb7dca /common.mk | |
parent | 51de3aa2b27859305c74d5664724192602c4608f (diff) | |
download | ruby-76c4cca19c0c27b1c3ca6f597384707cccf3de06.tar.gz |
add performance counting mechanism for MRI debug/tuning purpose.
* How to enable this feature?
* define USE_DEBUG_COUNTER as 1.
* you can disable to output the result with
RUBY_DEBUG_COUNTER_DISABLE environment variable
even if USE_DEBUG_COUNTER == 1.
* How to add new counter?
* add COUNTER(<name>) line on debug_counter.h.
* include "debug_counter.h"
* insert RB_DEBUG_COUNTER_INC(<name>) line on your favorite place.
* counter output example:
[RUBY_DEBUG_COUNTER] mc_inline_hit 999
[RUBY_DEBUG_COUNTER] mc_inline_miss 3
[RUBY_DEBUG_COUNTER] mc_global_hit 23
[RUBY_DEBUG_COUNTER] mc_global_miss 273
[RUBY_DEBUG_COUNTER] mc_global_state_miss 3
[RUBY_DEBUG_COUNTER] mc_class_serial_miss 0
[RUBY_DEBUG_COUNTER] mc_cme_complement 0
[RUBY_DEBUG_COUNTER] mc_cme_complement_hit 0
[RUBY_DEBUG_COUNTER] mc_search_super 1384
[RUBY_DEBUG_COUNTER] ivar_get_hit 0
[RUBY_DEBUG_COUNTER] ivar_get_miss 0
[RUBY_DEBUG_COUNTER] ivar_set_hit 0
[RUBY_DEBUG_COUNTER] ivar_set_miss 0
[RUBY_DEBUG_COUNTER] ivar_get 431
[RUBY_DEBUG_COUNTER] ivar_set 465
* mc_... is related to method caching.
* ivar_... is related to instance variable accesses.
* compare with dtrace/system tap features, there are completely
no performacne penalties when it is disabled.
* This feature is supported only on __GNUC__ compilers.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57676 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'common.mk')
-rw-r--r-- | common.mk | 13 |
1 files changed, 12 insertions, 1 deletions
@@ -79,6 +79,7 @@ COMMONOBJS = array.$(OBJEXT) \ complex.$(OBJEXT) \ cont.$(OBJEXT) \ debug.$(OBJEXT) \ + debug_counter.$(OBJEXT) \ dir.$(OBJEXT) \ dln_find.$(OBJEXT) \ encoding.$(OBJEXT) \ @@ -849,10 +850,15 @@ incs: $(INSNS) {$(VPATH)}node_name.inc {$(VPATH)}known_errors.inc \ {$(VPATH)}vm_call_iseq_optimized.inc $(srcdir)/revision.h \ $(REVISION_H) \ $(UNICODE_DATA_HEADERS) $(srcdir)/enc/jis/props.h \ - {$(VPATH)}id.h {$(VPATH)}probes.dmyh + {$(VPATH)}id.h {$(VPATH)}probes.dmyh \ + {$(VPATH)}debug_counter_names.inc insns: $(INSNS) +debug_counter_names.inc: $(srcdir)/tool/debug_counter.rb $(srcdir)/debug_counter.h + $(ECHO) generating $@ + $(Q) $(BASERUBY) $(srcdir)/tool/debug_counter.rb $(srcdir)/debug_counter.h > $@ + id.h: $(srcdir)/tool/generic_erb.rb $(srcdir)/template/id.h.tmpl $(srcdir)/defs/id.def $(ECHO) generating $@ $(Q) $(BASERUBY) $(srcdir)/tool/generic_erb.rb --output=$@ \ @@ -1420,6 +1426,9 @@ debug.$(OBJEXT): {$(VPATH)}util.h debug.$(OBJEXT): {$(VPATH)}vm_core.h debug.$(OBJEXT): {$(VPATH)}vm_debug.h debug.$(OBJEXT): {$(VPATH)}vm_opts.h +debug_counter.$(OBJEXT): {$(VPATH)}debug_counter.h +debug_counter.$(OBJEXT): {$(VPATH)}debug_counter_names.inc +debug_counter.$(OBJEXT): {$(VPATH)}debug_counter.c dir.$(OBJEXT): $(hdrdir)/ruby/ruby.h dir.$(OBJEXT): $(top_srcdir)/include/ruby.h dir.$(OBJEXT): {$(VPATH)}config.h @@ -2534,6 +2543,7 @@ variable.$(OBJEXT): $(top_srcdir)/include/ruby.h variable.$(OBJEXT): {$(VPATH)}config.h variable.$(OBJEXT): {$(VPATH)}constant.h variable.$(OBJEXT): {$(VPATH)}defines.h +variable.$(OBJEXT): {$(VPATH)}debug_counter.h variable.$(OBJEXT): {$(VPATH)}encoding.h variable.$(OBJEXT): {$(VPATH)}id.h variable.$(OBJEXT): {$(VPATH)}id_table.h @@ -2568,6 +2578,7 @@ vm.$(OBJEXT): {$(VPATH)}constant.h vm.$(OBJEXT): {$(VPATH)}defines.h vm.$(OBJEXT): {$(VPATH)}encoding.h vm.$(OBJEXT): {$(VPATH)}eval_intern.h +vm.$(OBJEXT): {$(VPATH)}debug_counter.h vm.$(OBJEXT): {$(VPATH)}gc.h vm.$(OBJEXT): {$(VPATH)}id.h vm.$(OBJEXT): {$(VPATH)}id_table.h |