Ruby  2.5.0dev(2017-10-22revision60238)
debug_counter.c
Go to the documentation of this file.
1 /**********************************************************************
2 
3  debug_counter.c -
4 
5  created at: Tue Feb 21 16:51:18 2017
6 
7  Copyright (C) 2017 Koichi Sasada
8 
9 **********************************************************************/
10 
11 #include "debug_counter.h"
12 #include <stdio.h>
13 
14 #if USE_DEBUG_COUNTER
15 #include "internal.h"
16 
17 static const char *const debug_counter_names[] = {
18  ""
19 #define RB_DEBUG_COUNTER(name) #name,
20 #include "debug_counter.h"
21 #undef RB_DEBUG_COUNTER
22 };
23 
24 size_t rb_debug_counter[numberof(debug_counter_names)];
25 
26 __attribute__((destructor))
27 static void
28 rb_debug_counter_show_results(void)
29 {
30  const char *env = getenv("RUBY_DEBUG_COUNTER_DISABLE");
31  if (env == NULL || strcmp("1", env) != 0) {
32  int i;
33  for (i=0; i<RB_DEBUG_COUNTER_MAX; i++) {
34  fprintf(stderr, "[RUBY_DEBUG_COUNTER]\t%s\t%"PRIuSIZE"\n",
35  debug_counter_names[i],
36  rb_debug_counter[i]);
37  }
38  }
39 }
40 
41 #endif /* USE_DEBUG_COUNTER */
#define numberof(array)
Definition: etc.c:618
#define getenv(name)
Definition: win32.c:71
#define PRIuSIZE
Definition: ruby.h:177
#define env
#define NULL
Definition: _sdbm.c:102