11#ifndef USE_DEBUG_COUNTER
12#define USE_DEBUG_COUNTER 0
15#ifdef RB_DEBUG_COUNTER
18RB_DEBUG_COUNTER(mc_inline_hit)
19RB_DEBUG_COUNTER(mc_inline_miss_klass)
20RB_DEBUG_COUNTER(mc_inline_miss_invalidated)
21RB_DEBUG_COUNTER(mc_inline_miss_empty)
22RB_DEBUG_COUNTER(mc_inline_miss_same_cc)
23RB_DEBUG_COUNTER(mc_inline_miss_same_cme)
24RB_DEBUG_COUNTER(mc_inline_miss_same_def)
25RB_DEBUG_COUNTER(mc_inline_miss_diff)
27RB_DEBUG_COUNTER(cvar_write_inline_hit)
28RB_DEBUG_COUNTER(cvar_read_inline_hit)
29RB_DEBUG_COUNTER(cvar_inline_miss)
30RB_DEBUG_COUNTER(cvar_class_invalidate)
31RB_DEBUG_COUNTER(cvar_include_invalidate)
33RB_DEBUG_COUNTER(mc_cme_complement)
34RB_DEBUG_COUNTER(mc_cme_complement_hit)
36RB_DEBUG_COUNTER(mc_search)
37RB_DEBUG_COUNTER(mc_search_notfound)
38RB_DEBUG_COUNTER(mc_search_super)
41RB_DEBUG_COUNTER(ci_packed)
42RB_DEBUG_COUNTER(ci_kw)
43RB_DEBUG_COUNTER(ci_nokw)
44RB_DEBUG_COUNTER(ci_runtime)
47RB_DEBUG_COUNTER(cc_new)
48RB_DEBUG_COUNTER(cc_temp)
49RB_DEBUG_COUNTER(cc_found_in_ccs)
50RB_DEBUG_COUNTER(cc_not_found_in_ccs)
52RB_DEBUG_COUNTER(cc_ent_invalidate)
53RB_DEBUG_COUNTER(cc_cme_invalidate)
55RB_DEBUG_COUNTER(cc_invalidate_leaf)
56RB_DEBUG_COUNTER(cc_invalidate_leaf_ccs)
57RB_DEBUG_COUNTER(cc_invalidate_leaf_callable)
58RB_DEBUG_COUNTER(cc_invalidate_tree)
59RB_DEBUG_COUNTER(cc_invalidate_tree_cme)
60RB_DEBUG_COUNTER(cc_invalidate_tree_callable)
61RB_DEBUG_COUNTER(cc_invalidate_negative)
63RB_DEBUG_COUNTER(ccs_free)
64RB_DEBUG_COUNTER(ccs_maxlen)
65RB_DEBUG_COUNTER(ccs_found)
66RB_DEBUG_COUNTER(ccs_not_found)
69RB_DEBUG_COUNTER(call0_public)
70RB_DEBUG_COUNTER(call0_other)
71RB_DEBUG_COUNTER(gccct_hit)
72RB_DEBUG_COUNTER(gccct_miss)
73RB_DEBUG_COUNTER(gccct_null)
76RB_DEBUG_COUNTER(iseq_num)
77RB_DEBUG_COUNTER(iseq_cd_num)
82RB_DEBUG_COUNTER(ccf_general)
83RB_DEBUG_COUNTER(ccf_iseq_setup)
84RB_DEBUG_COUNTER(ccf_iseq_setup_0start)
85RB_DEBUG_COUNTER(ccf_iseq_setup_tailcall_0start)
86RB_DEBUG_COUNTER(ccf_iseq_fix)
87RB_DEBUG_COUNTER(ccf_iseq_opt)
88RB_DEBUG_COUNTER(ccf_iseq_kw1)
89RB_DEBUG_COUNTER(ccf_iseq_kw2)
90RB_DEBUG_COUNTER(ccf_cfunc)
91RB_DEBUG_COUNTER(ccf_cfunc_with_frame)
92RB_DEBUG_COUNTER(ccf_ivar)
93RB_DEBUG_COUNTER(ccf_attrset)
94RB_DEBUG_COUNTER(ccf_method_missing)
95RB_DEBUG_COUNTER(ccf_zsuper)
96RB_DEBUG_COUNTER(ccf_bmethod)
97RB_DEBUG_COUNTER(ccf_opt_send)
98RB_DEBUG_COUNTER(ccf_opt_call)
99RB_DEBUG_COUNTER(ccf_opt_block_call)
100RB_DEBUG_COUNTER(ccf_opt_struct_aref)
101RB_DEBUG_COUNTER(ccf_opt_struct_aset)
102RB_DEBUG_COUNTER(ccf_super_method)
103RB_DEBUG_COUNTER(ccf_cfunc_other)
104RB_DEBUG_COUNTER(ccf_cfunc_only_splat)
105RB_DEBUG_COUNTER(ccf_cfunc_only_splat_kw)
106RB_DEBUG_COUNTER(ccf_iseq_bmethod)
107RB_DEBUG_COUNTER(ccf_noniseq_bmethod)
108RB_DEBUG_COUNTER(ccf_opt_send_complex)
109RB_DEBUG_COUNTER(ccf_opt_send_simple)
121RB_DEBUG_COUNTER(frame_push)
122RB_DEBUG_COUNTER(frame_push_method)
123RB_DEBUG_COUNTER(frame_push_block)
124RB_DEBUG_COUNTER(frame_push_class)
125RB_DEBUG_COUNTER(frame_push_top)
126RB_DEBUG_COUNTER(frame_push_cfunc)
127RB_DEBUG_COUNTER(frame_push_ifunc)
128RB_DEBUG_COUNTER(frame_push_eval)
129RB_DEBUG_COUNTER(frame_push_rescue)
130RB_DEBUG_COUNTER(frame_push_dummy)
132RB_DEBUG_COUNTER(frame_R2R)
133RB_DEBUG_COUNTER(frame_R2C)
134RB_DEBUG_COUNTER(frame_C2C)
135RB_DEBUG_COUNTER(frame_C2R)
138RB_DEBUG_COUNTER(ivar_get_obj_hit)
139RB_DEBUG_COUNTER(ivar_get_obj_miss)
140RB_DEBUG_COUNTER(ivar_get_ic_hit)
141RB_DEBUG_COUNTER(ivar_get_ic_miss)
142RB_DEBUG_COUNTER(ivar_set_ic_hit)
143RB_DEBUG_COUNTER(ivar_set_obj_hit)
144RB_DEBUG_COUNTER(ivar_set_obj_miss)
145RB_DEBUG_COUNTER(ivar_set_ic_miss)
146RB_DEBUG_COUNTER(ivar_set_ic_miss_noobject)
147RB_DEBUG_COUNTER(ivar_get_base)
148RB_DEBUG_COUNTER(ivar_set_base)
149RB_DEBUG_COUNTER(ivar_get_ic_miss_set)
150RB_DEBUG_COUNTER(ivar_get_cc_miss_set)
151RB_DEBUG_COUNTER(ivar_get_ic_miss_unset)
152RB_DEBUG_COUNTER(ivar_get_cc_miss_unset)
161RB_DEBUG_COUNTER(lvar_get)
162RB_DEBUG_COUNTER(lvar_get_dynamic)
163RB_DEBUG_COUNTER(lvar_set)
164RB_DEBUG_COUNTER(lvar_set_dynamic)
165RB_DEBUG_COUNTER(lvar_set_slowpath)
175RB_DEBUG_COUNTER(gc_count)
176RB_DEBUG_COUNTER(gc_minor_newobj)
177RB_DEBUG_COUNTER(gc_minor_malloc)
178RB_DEBUG_COUNTER(gc_minor_method)
179RB_DEBUG_COUNTER(gc_minor_capi)
180RB_DEBUG_COUNTER(gc_minor_stress)
181RB_DEBUG_COUNTER(gc_major_nofree)
182RB_DEBUG_COUNTER(gc_major_oldgen)
183RB_DEBUG_COUNTER(gc_major_shady)
184RB_DEBUG_COUNTER(gc_major_force)
185RB_DEBUG_COUNTER(gc_major_oldmalloc)
187RB_DEBUG_COUNTER(gc_enter_start)
188RB_DEBUG_COUNTER(gc_enter_continue)
189RB_DEBUG_COUNTER(gc_enter_rest)
190RB_DEBUG_COUNTER(gc_enter_finalizer)
192RB_DEBUG_COUNTER(gc_isptr_trial)
193RB_DEBUG_COUNTER(gc_isptr_range)
194RB_DEBUG_COUNTER(gc_isptr_align)
195RB_DEBUG_COUNTER(gc_isptr_maybe)
234RB_DEBUG_COUNTER(obj_newobj)
235RB_DEBUG_COUNTER(obj_newobj_slowpath)
236RB_DEBUG_COUNTER(obj_newobj_wb_unprotected)
237RB_DEBUG_COUNTER(obj_free)
238RB_DEBUG_COUNTER(obj_promote)
239RB_DEBUG_COUNTER(obj_wb_unprotect)
241RB_DEBUG_COUNTER(obj_obj_embed)
242RB_DEBUG_COUNTER(obj_obj_ptr)
243RB_DEBUG_COUNTER(obj_obj_too_complex)
245RB_DEBUG_COUNTER(obj_str_ptr)
246RB_DEBUG_COUNTER(obj_str_embed)
247RB_DEBUG_COUNTER(obj_str_shared)
248RB_DEBUG_COUNTER(obj_str_nofree)
249RB_DEBUG_COUNTER(obj_str_fstr)
251RB_DEBUG_COUNTER(obj_ary_embed)
252RB_DEBUG_COUNTER(obj_ary_ptr)
253RB_DEBUG_COUNTER(obj_ary_extracapa)
260RB_DEBUG_COUNTER(obj_ary_shared_create)
261RB_DEBUG_COUNTER(obj_ary_shared)
262RB_DEBUG_COUNTER(obj_ary_shared_root_occupied)
264RB_DEBUG_COUNTER(obj_hash_empty)
265RB_DEBUG_COUNTER(obj_hash_1)
266RB_DEBUG_COUNTER(obj_hash_2)
267RB_DEBUG_COUNTER(obj_hash_3)
268RB_DEBUG_COUNTER(obj_hash_4)
269RB_DEBUG_COUNTER(obj_hash_5_8)
270RB_DEBUG_COUNTER(obj_hash_g8)
272RB_DEBUG_COUNTER(obj_hash_null)
273RB_DEBUG_COUNTER(obj_hash_ar)
274RB_DEBUG_COUNTER(obj_hash_st)
275RB_DEBUG_COUNTER(obj_hash_force_convert)
277RB_DEBUG_COUNTER(obj_struct_embed)
278RB_DEBUG_COUNTER(obj_struct_ptr)
280RB_DEBUG_COUNTER(obj_data_empty)
281RB_DEBUG_COUNTER(obj_data_xfree)
282RB_DEBUG_COUNTER(obj_data_imm_free)
283RB_DEBUG_COUNTER(obj_data_zombie)
285RB_DEBUG_COUNTER(obj_match_under4)
286RB_DEBUG_COUNTER(obj_match_ge4)
287RB_DEBUG_COUNTER(obj_match_ge8)
288RB_DEBUG_COUNTER(obj_match_ptr)
290RB_DEBUG_COUNTER(obj_iclass_ptr)
291RB_DEBUG_COUNTER(obj_class_ptr)
292RB_DEBUG_COUNTER(obj_module_ptr)
294RB_DEBUG_COUNTER(obj_bignum_ptr)
295RB_DEBUG_COUNTER(obj_bignum_embed)
296RB_DEBUG_COUNTER(obj_float)
297RB_DEBUG_COUNTER(obj_complex)
298RB_DEBUG_COUNTER(obj_rational)
300RB_DEBUG_COUNTER(obj_regexp_ptr)
301RB_DEBUG_COUNTER(obj_file_ptr)
302RB_DEBUG_COUNTER(obj_symbol)
304RB_DEBUG_COUNTER(obj_imemo_ment)
305RB_DEBUG_COUNTER(obj_imemo_iseq)
306RB_DEBUG_COUNTER(obj_imemo_env)
307RB_DEBUG_COUNTER(obj_imemo_tmpbuf)
308RB_DEBUG_COUNTER(obj_imemo_ast)
309RB_DEBUG_COUNTER(obj_imemo_cref)
310RB_DEBUG_COUNTER(obj_imemo_svar)
311RB_DEBUG_COUNTER(obj_imemo_throw_data)
312RB_DEBUG_COUNTER(obj_imemo_ifunc)
313RB_DEBUG_COUNTER(obj_imemo_memo)
314RB_DEBUG_COUNTER(obj_imemo_parser_strterm)
315RB_DEBUG_COUNTER(obj_imemo_callinfo)
316RB_DEBUG_COUNTER(obj_imemo_callcache)
317RB_DEBUG_COUNTER(obj_imemo_constcache)
320RB_DEBUG_COUNTER(artable_hint_hit)
321RB_DEBUG_COUNTER(artable_hint_miss)
322RB_DEBUG_COUNTER(artable_hint_notfound)
328RB_DEBUG_COUNTER(heap_xmalloc)
329RB_DEBUG_COUNTER(heap_xrealloc)
330RB_DEBUG_COUNTER(heap_xfree)
333RB_DEBUG_COUNTER(vm_sync_lock)
334RB_DEBUG_COUNTER(vm_sync_lock_enter)
335RB_DEBUG_COUNTER(vm_sync_lock_enter_nb)
336RB_DEBUG_COUNTER(vm_sync_lock_enter_cr)
337RB_DEBUG_COUNTER(vm_sync_barrier)
346#ifndef RUBY_DEBUG_COUNTER_H
347#define RUBY_DEBUG_COUNTER_H 1
349#include "ruby/internal/config.h"
353#if !defined(__GNUC__) && USE_DEBUG_COUNTER
354#error "USE_DEBUG_COUNTER is not supported by other than __GNUC__"
357enum rb_debug_counter_type {
358#define RB_DEBUG_COUNTER(name) RB_DEBUG_COUNTER_##name,
359#include "debug_counter.h"
361#undef RB_DEBUG_COUNTER
365extern size_t rb_debug_counter[];
367RUBY_EXTERN void rb_debug_counter_add_atomic(
enum rb_debug_counter_type
type,
int add);
370rb_debug_counter_add(
enum rb_debug_counter_type
type,
int add,
int cond)
373 if (ruby_single_main_ractor != NULL) {
374 rb_debug_counter[(int)
type] += add;
377 rb_debug_counter_add_atomic(
type, add);
384rb_debug_counter_max(
enum rb_debug_counter_type
type,
unsigned int num)
387 if (rb_debug_counter[(
int)
type] < num) {
388 rb_debug_counter[(int)
type] = num;
399#define RB_DEBUG_COUNTER_INC(type) rb_debug_counter_add(RB_DEBUG_COUNTER_##type, 1, 1)
400#define RB_DEBUG_COUNTER_INC_UNLESS(type, cond) (!rb_debug_counter_add(RB_DEBUG_COUNTER_##type, 1, !(cond)))
401#define RB_DEBUG_COUNTER_INC_IF(type, cond) rb_debug_counter_add(RB_DEBUG_COUNTER_##type, 1, !!(cond))
402#define RB_DEBUG_COUNTER_ADD(type, num) rb_debug_counter_add(RB_DEBUG_COUNTER_##type, (num), 1)
403#define RB_DEBUG_COUNTER_SETMAX(type, num) rb_debug_counter_max(RB_DEBUG_COUNTER_##type, (unsigned int)(num))
406#define RB_DEBUG_COUNTER_INC(type) ((void)0)
407#define RB_DEBUG_COUNTER_INC_UNLESS(type, cond) (!!(cond))
408#define RB_DEBUG_COUNTER_INC_IF(type, cond) (!!(cond))
409#define RB_DEBUG_COUNTER_ADD(type, num) ((void)0)
410#define RB_DEBUG_COUNTER_SETMAX(type, num) 0
413void rb_debug_counter_show_results(
const char *msg);
415RUBY_SYMBOL_EXPORT_BEGIN
417size_t ruby_debug_counter_get(
const char **names_ptr,
size_t *counters_ptr);
418void ruby_debug_counter_reset(
void);
419void ruby_debug_counter_show_at_exit(
int enable);
421RUBY_SYMBOL_EXPORT_END
#define RUBY_EXTERN
Declaration of externally visible global variables.
VALUE type(ANYARGS)
ANYARGS-ed function type.
uintptr_t VALUE
Type that represents a Ruby object.