diff options
Diffstat (limited to 'debug_counter.c')
-rw-r--r-- | debug_counter.c | 38 |
1 files changed, 14 insertions, 24 deletions
diff --git a/debug_counter.c b/debug_counter.c index e7b0bb0acd..3dcc4c6a3a 100644 --- a/debug_counter.c +++ b/debug_counter.c @@ -16,19 +16,19 @@ #if USE_DEBUG_COUNTER -static const char *const debug_counter_names[] = { - "" +const char *const rb_debug_counter_names[] = { +#define DEBUG_COUNTER_NAME_EMPTY "" /* Suppress -Wstring-concatenation */ + DEBUG_COUNTER_NAME_EMPTY +#undef DEBUG_COUNTER_NAME_EMPTY #define RB_DEBUG_COUNTER(name) #name, #include "debug_counter.h" #undef RB_DEBUG_COUNTER }; -MJIT_SYMBOL_EXPORT_BEGIN -size_t rb_debug_counter[numberof(debug_counter_names)]; +size_t rb_debug_counter[numberof(rb_debug_counter_names)]; void rb_debug_counter_add_atomic(enum rb_debug_counter_type type, int add); -MJIT_SYMBOL_EXPORT_END -rb_nativethread_lock_t debug_counter_lock; +static rb_nativethread_lock_t debug_counter_lock; __attribute__((constructor)) static void @@ -47,24 +47,14 @@ rb_debug_counter_add_atomic(enum rb_debug_counter_type type, int add) rb_nativethread_lock_unlock(&debug_counter_lock); } -int debug_counter_disable_show_at_exit = 0; +static int debug_counter_disable_show_at_exit = 0; // note that this operation is not atomic. void ruby_debug_counter_reset(void) { for (int i = 0; i < RB_DEBUG_COUNTER_MAX; i++) { - switch (i) { - case RB_DEBUG_COUNTER_mjit_length_unit_queue: - case RB_DEBUG_COUNTER_mjit_length_active_units: - case RB_DEBUG_COUNTER_mjit_length_compact_units: - case RB_DEBUG_COUNTER_mjit_length_stale_units: - // These counters may be decreased and should not be reset. - break; - default: - rb_debug_counter[i] = 0; - break; - } + rb_debug_counter[i] = 0; } } @@ -75,7 +65,7 @@ ruby_debug_counter_get(const char **names_ptr, size_t *counters_ptr) int i; if (names_ptr != NULL) { for (i=0; i<RB_DEBUG_COUNTER_MAX; i++) { - names_ptr[i] = debug_counter_names[i]; + names_ptr[i] = rb_debug_counter_names[i]; } } if (counters_ptr != NULL) { @@ -101,13 +91,13 @@ rb_debug_counter_show_results(const char *msg) setlocale(LC_NUMERIC, ""); if (env == NULL || strcmp("1", env) != 0) { - int i; + int i; fprintf(stderr, "[RUBY_DEBUG_COUNTER]\t%d %s\n", getpid(), msg); - for (i=0; i<RB_DEBUG_COUNTER_MAX; i++) { + for (i=0; i<RB_DEBUG_COUNTER_MAX; i++) { fprintf(stderr, "[RUBY_DEBUG_COUNTER]\t%-30s\t%'14"PRIuSIZE"\n", - debug_counter_names[i], - rb_debug_counter[i]); - } + rb_debug_counter_names[i], + rb_debug_counter[i]); + } } } |