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 | 595e3b9ac1af458b297e4ac6d2a68ca041942762 (patch) | |
tree | bcb13fed3f68e50cbca8a4bd475157d9bfeb7dca /tool | |
parent | 8bce091bab2b6d09605d8bef68bd7bd62f0e2f45 (diff) | |
download | ruby-595e3b9ac1af458b297e4ac6d2a68ca041942762.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 'tool')
-rw-r--r-- | tool/debug_counter.rb | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/tool/debug_counter.rb b/tool/debug_counter.rb new file mode 100644 index 0000000000..79c7b08269 --- /dev/null +++ b/tool/debug_counter.rb @@ -0,0 +1,6 @@ + +ARGF.each_line{|line| + if /^\s+COUNTER\((.+)\),$/ =~ line + puts "\"#{$1}\"," + end +} |