Граф коммитов

21 Коммитов

Автор SHA1 Сообщение Дата
Chris Seaton 645cd94d9a
Add debug counters to RubyVM.stat (#6086)
* Add debug counters to RubyVM.stat

* Use SIZET2NUM

Co-author: Nobuyoshi Nakada <nobu@ruby-lang.org>

* Prefix debug_counter_names
2022-12-07 17:09:30 -08:00
Takashi Kokubun 57cb4a8179
MJIT: Remove obsoleted MJIT counters 2022-12-06 23:05:00 -08:00
Takashi Kokubun 5b21e94beb Expand tabs [ci skip]
[Misc #18891]
2022-07-21 09:42:04 -07:00
Nobuyoshi Nakada 62084e1930
Fix leaked global symbols for debug counter 2022-07-03 00:05:53 +09:00
Nobuyoshi Nakada d8be7d463d
Suppress -Wstring-concatenation
This concatenation of string literals is to not empty the array
initialization even if no counter is declared, but warned by clang as
suspicious.
2022-07-03 00:05:53 +09:00
Koichi Sasada c58142134c make RB_DEBUG_COUNTER_INC()_thread-safe 2020-12-17 03:43:59 +09:00
Takashi Kokubun d79890cbfa
Avoid doubly showing debug counters
when RubyVM.show_debug_counters is explicitly called.

According to the original description in 70fd099220,
I think it's not intended to use the exit counter at all, and I'd like
to skip it when I need to explicitly call this.
2020-03-15 02:25:47 -07:00
Koichi Sasada 5220145ea2 add debug_counter access functions.
These functions are enabled only on USE_DEBUG_COUNTER=1.
2019-12-25 01:34:41 +09:00
Rei Odaira 50ae8895f3 debug_counter.c: include ruby/config.h before stdio.h
to define _LARGE_FILES
2019-12-11 13:33:27 -06:00
Nobuyoshi Nakada e1b2341488
Update dependencies 2019-11-18 23:16:22 +09:00
Takashi Kokubun 4ffcadd39c
Fix rb_define_singleton_method warning
for debug counters

```
../include/ruby/intern.h:1175:137: warning: passing argument 3 of 'rb_define_singleton_method0' from incompatible pointer type [-Wincompatible-pointer-types]
 #define rb_define_singleton_method(klass, mid, func, arity) rb_define_singleton_method_choose_prototypem3((arity),(func))((klass),(mid),(func),(arity));
                                                                                                                                         ^
../vm.c:2958:5: note: in expansion of macro 'rb_define_singleton_method'
     rb_define_singleton_method(rb_cRubyVM, "show_debug_counters", rb_debug_counter_show, 0);
     ^~~~~~~~~~~~~~~~~~~~~~~~~~
../include/ruby/intern.h:1139:99: note: expected 'VALUE (*)(VALUE) {aka long unsigned int (*)(long unsigned int)}' but argument is of type 'VALUE (*)(void) {aka long unsigned int (*)(void)}'
 __attribute__((__unused__,__weakref__("rb_define_singleton_method"),__nonnull__(2,3)))static void rb_define_singleton_method0 (VALUE,const char*,VALUE(*)(VALUE),int);
```
2019-09-20 17:44:48 +09:00
Aaron Patterson 70fd099220
Add a way to print debug counters without exiting
I am trying to study debug counters inside a Rails application.
Accessing debug counters by killing the process is hard because child
processes don't get the same TRAP as the parent, and Rails seems to
intercept calls to `exit`.  Adding this method lets me print the debug
counters when I want (at the end of requests for example)
2019-08-07 10:36:17 -07:00
k0kubun 18b5148215 Add debug counter for MJIT stale_units
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67546 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-04-14 07:12:44 +00:00
k0kubun f7035dd3ff Do not reset non-increment-only counters
to prevernt underflow.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67545 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-04-14 07:10:34 +00:00
k0kubun 5ce28c0642 Add RubyVM.reset_debug_counters when RB_DEBUG_COUNTER
is defined. It's 0 by default and so it dissappears on actual build.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67544 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-04-14 06:57:21 +00:00
k0kubun b03c11a337 Add debug counters for MJIT cancel
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67379 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-03-29 13:54:29 +00:00
ko1 df5ec4107d add debug counters more.
* debug_counter.h: add the following counters.
  * frame_push: control frame counts (total counts).
  * frame_push_*: control frame counts per every frame type.
  * obj_*: add free'ed counts for each type.

* gc.c: ditto.

* vm_insnhelper.c (vm_push_frame): ditto.

* debug_counter.c (rb_debug_counter_show_results): widen counts field
  to show >10G numbers.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64867 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-09-28 01:10:43 +00:00
svn 2466288d27 * expand tabs.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64842 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-09-25 18:13:35 +00:00
ko1 cdc614cd0a refactoring debug_counter.
* debug_counter.h: add comments for each counters.

* debug_counter.h: add some counters (see added comments for details).
  * obj_newobj
  * obj_newobj_slowpath
  * obj_newobj_wb_unprotected
  * obj_hash_empty
  * obj_hash_under4
  * obj_hash_ge4
  * obj_hash_ge8
  * heap_xmalloc
  * heap_xrealloc
  * heap_xfree

* gc.c: add some debug counters (see the above list).

* debug_counter.c (rb_debug_counter_show_results): accept
  a header message.

* signal.c (ruby_default_signal): show debug counter results
  and malloc info (rb_malloc_info_show_results()) before
  SIGNAL exit.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64841 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-09-25 18:13:29 +00:00
nobu b80c265fa4 debug_counter.c: debug_counter_names [ci skip]
* debug_counter.c (debug_counter_names): stringize debug counter
  names by preprocessor.

* debug_counter.h (RB_DEBUG_COUNTER): define counter names outside
  the include guard, to expand multiple times.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57826 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-03-10 07:18:03 +00:00
ko1 76c4cca19c 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
2017-02-21 08:18:15 +00:00