зеркало из https://github.com/github/ruby.git
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
This commit is contained in:
Родитель
ac3b77c98e
Коммит
b80c265fa4
|
@ -886,15 +886,10 @@ 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)}debug_counter_names.inc
|
||||
{$(VPATH)}id.h {$(VPATH)}probes.dmyh
|
||||
|
||||
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=$@ \
|
||||
|
@ -1466,7 +1461,6 @@ 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
|
||||
|
|
|
@ -12,14 +12,16 @@
|
|||
#include <stdio.h>
|
||||
|
||||
#if USE_DEBUG_COUNTER
|
||||
#include "internal.h"
|
||||
|
||||
/* do not modify manually. use a script above */
|
||||
const char * const debug_counter_names[] = {
|
||||
#include "debug_counter_names.inc"
|
||||
static const char *const debug_counter_names[] = {
|
||||
""
|
||||
#define RB_DEBUG_COUNTER(name) #name,
|
||||
#include "debug_counter.h"
|
||||
#undef RB_DEBUG_COUNTER
|
||||
};
|
||||
|
||||
size_t rb_debug_counter[RB_DEBUG_COUNTER_MAX + 1];
|
||||
size_t rb_debug_counter[numberof(debug_counter_names)];
|
||||
|
||||
__attribute__((destructor))
|
||||
static void
|
||||
|
|
|
@ -8,42 +8,46 @@
|
|||
|
||||
**********************************************************************/
|
||||
|
||||
#ifndef RUBY_DEBUG_COUNTER_H
|
||||
#define RUBY_DEBUG_COUNTER_H 1
|
||||
|
||||
#ifndef USE_DEBUG_COUNTER
|
||||
#define USE_DEBUG_COUNTER 0
|
||||
#endif
|
||||
|
||||
#ifdef RB_DEBUG_COUNTER
|
||||
RB_DEBUG_COUNTER(mc_inline_hit)
|
||||
RB_DEBUG_COUNTER(mc_inline_miss)
|
||||
RB_DEBUG_COUNTER(mc_global_hit)
|
||||
RB_DEBUG_COUNTER(mc_global_miss)
|
||||
RB_DEBUG_COUNTER(mc_global_state_miss)
|
||||
RB_DEBUG_COUNTER(mc_class_serial_miss)
|
||||
RB_DEBUG_COUNTER(mc_cme_complement)
|
||||
RB_DEBUG_COUNTER(mc_cme_complement_hit)
|
||||
RB_DEBUG_COUNTER(mc_search_super)
|
||||
RB_DEBUG_COUNTER(ivar_get_hit)
|
||||
RB_DEBUG_COUNTER(ivar_get_miss)
|
||||
RB_DEBUG_COUNTER(ivar_set_hit)
|
||||
RB_DEBUG_COUNTER(ivar_set_miss)
|
||||
RB_DEBUG_COUNTER(ivar_get)
|
||||
RB_DEBUG_COUNTER(ivar_set)
|
||||
#endif
|
||||
|
||||
#ifndef RUBY_DEBUG_COUNTER_H
|
||||
#define RUBY_DEBUG_COUNTER_H 1
|
||||
|
||||
#if !defined(__GNUC__) && USE_DEBUG_COUNTER
|
||||
#error "USE_DEBUG_COUNTER is not supported by other than __GNUC__"
|
||||
#endif
|
||||
|
||||
enum rb_debug_counter_type {
|
||||
#define COUNTER(name) RB_DEBUG_COUNTER_##name
|
||||
COUNTER(mc_inline_hit),
|
||||
COUNTER(mc_inline_miss),
|
||||
COUNTER(mc_global_hit),
|
||||
COUNTER(mc_global_miss),
|
||||
COUNTER(mc_global_state_miss),
|
||||
COUNTER(mc_class_serial_miss),
|
||||
COUNTER(mc_cme_complement),
|
||||
COUNTER(mc_cme_complement_hit),
|
||||
COUNTER(mc_search_super),
|
||||
COUNTER(ivar_get_hit),
|
||||
COUNTER(ivar_get_miss),
|
||||
COUNTER(ivar_set_hit),
|
||||
COUNTER(ivar_set_miss),
|
||||
COUNTER(ivar_get),
|
||||
COUNTER(ivar_set),
|
||||
#define RB_DEBUG_COUNTER(name) RB_DEBUG_COUNTER_##name,
|
||||
#include "debug_counter.h"
|
||||
RB_DEBUG_COUNTER_MAX
|
||||
#undef COUNTER
|
||||
#undef RB_DEBUG_COUNTER
|
||||
};
|
||||
|
||||
#if USE_DEBUG_COUNTER
|
||||
#include "ruby/ruby.h"
|
||||
|
||||
extern size_t rb_debug_counter[RB_DEBUG_COUNTER_MAX + 1];
|
||||
extern size_t rb_debug_counter[];
|
||||
|
||||
inline static int
|
||||
rb_debug_counter_add(enum rb_debug_counter_type type, int add, int cond)
|
||||
|
|
|
@ -1,6 +0,0 @@
|
|||
|
||||
ARGF.each_line{|line|
|
||||
if /^\s+COUNTER\((.+)\),$/ =~ line
|
||||
puts "\"#{$1}\","
|
||||
end
|
||||
}
|
Загрузка…
Ссылка в новой задаче