mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
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:
parent
ac3b77c98e
commit
b80c265fa4
4 changed files with 32 additions and 38 deletions
|
@ -886,15 +886,10 @@ incs: $(INSNS) {$(VPATH)}node_name.inc {$(VPATH)}known_errors.inc \
|
||||||
{$(VPATH)}vm_call_iseq_optimized.inc $(srcdir)/revision.h \
|
{$(VPATH)}vm_call_iseq_optimized.inc $(srcdir)/revision.h \
|
||||||
$(REVISION_H) \
|
$(REVISION_H) \
|
||||||
$(UNICODE_DATA_HEADERS) $(srcdir)/enc/jis/props.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)
|
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
|
id.h: $(srcdir)/tool/generic_erb.rb $(srcdir)/template/id.h.tmpl $(srcdir)/defs/id.def
|
||||||
$(ECHO) generating $@
|
$(ECHO) generating $@
|
||||||
$(Q) $(BASERUBY) $(srcdir)/tool/generic_erb.rb --output=$@ \
|
$(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_debug.h
|
||||||
debug.$(OBJEXT): {$(VPATH)}vm_opts.h
|
debug.$(OBJEXT): {$(VPATH)}vm_opts.h
|
||||||
debug_counter.$(OBJEXT): {$(VPATH)}debug_counter.h
|
debug_counter.$(OBJEXT): {$(VPATH)}debug_counter.h
|
||||||
debug_counter.$(OBJEXT): {$(VPATH)}debug_counter_names.inc
|
|
||||||
debug_counter.$(OBJEXT): {$(VPATH)}debug_counter.c
|
debug_counter.$(OBJEXT): {$(VPATH)}debug_counter.c
|
||||||
dir.$(OBJEXT): $(hdrdir)/ruby/ruby.h
|
dir.$(OBJEXT): $(hdrdir)/ruby/ruby.h
|
||||||
dir.$(OBJEXT): $(top_srcdir)/include/ruby.h
|
dir.$(OBJEXT): $(top_srcdir)/include/ruby.h
|
||||||
|
|
|
@ -12,14 +12,16 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#if USE_DEBUG_COUNTER
|
#if USE_DEBUG_COUNTER
|
||||||
|
#include "internal.h"
|
||||||
|
|
||||||
/* do not modify manually. use a script above */
|
static const char *const debug_counter_names[] = {
|
||||||
const char * const debug_counter_names[] = {
|
|
||||||
#include "debug_counter_names.inc"
|
|
||||||
""
|
""
|
||||||
|
#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))
|
__attribute__((destructor))
|
||||||
static void
|
static void
|
||||||
|
|
|
@ -8,42 +8,46 @@
|
||||||
|
|
||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
|
|
||||||
#ifndef RUBY_DEBUG_COUNTER_H
|
|
||||||
#define RUBY_DEBUG_COUNTER_H 1
|
|
||||||
|
|
||||||
#ifndef USE_DEBUG_COUNTER
|
#ifndef USE_DEBUG_COUNTER
|
||||||
#define USE_DEBUG_COUNTER 0
|
#define USE_DEBUG_COUNTER 0
|
||||||
#endif
|
#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
|
#if !defined(__GNUC__) && USE_DEBUG_COUNTER
|
||||||
#error "USE_DEBUG_COUNTER is not supported by other than __GNUC__"
|
#error "USE_DEBUG_COUNTER is not supported by other than __GNUC__"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
enum rb_debug_counter_type {
|
enum rb_debug_counter_type {
|
||||||
#define COUNTER(name) RB_DEBUG_COUNTER_##name
|
#define RB_DEBUG_COUNTER(name) RB_DEBUG_COUNTER_##name,
|
||||||
COUNTER(mc_inline_hit),
|
#include "debug_counter.h"
|
||||||
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),
|
|
||||||
RB_DEBUG_COUNTER_MAX
|
RB_DEBUG_COUNTER_MAX
|
||||||
#undef COUNTER
|
#undef RB_DEBUG_COUNTER
|
||||||
};
|
};
|
||||||
|
|
||||||
#if USE_DEBUG_COUNTER
|
#if USE_DEBUG_COUNTER
|
||||||
#include "ruby/ruby.h"
|
#include "ruby/ruby.h"
|
||||||
|
|
||||||
extern size_t rb_debug_counter[RB_DEBUG_COUNTER_MAX + 1];
|
extern size_t rb_debug_counter[];
|
||||||
|
|
||||||
inline static int
|
inline static int
|
||||||
rb_debug_counter_add(enum rb_debug_counter_type type, int add, int cond)
|
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
|
|
||||||
}
|
|
Loading…
Add table
Add a link
Reference in a new issue