зеркало из https://github.com/github/ruby.git
add new debug_counters for GC.
* debug_counter.h: add new debug counters to count GC. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65359 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
0fbc28dec5
Коммит
f8dbff557a
|
@ -101,6 +101,25 @@ RB_DEBUG_COUNTER(lvar_set)
|
||||||
RB_DEBUG_COUNTER(lvar_set_dynamic)
|
RB_DEBUG_COUNTER(lvar_set_dynamic)
|
||||||
RB_DEBUG_COUNTER(lvar_set_slowpath)
|
RB_DEBUG_COUNTER(lvar_set_slowpath)
|
||||||
|
|
||||||
|
/* GC counts:
|
||||||
|
*
|
||||||
|
* * count: simple count
|
||||||
|
* * _minor: minor gc
|
||||||
|
* * _major: major gc
|
||||||
|
* * other suffix is corresponding to last_gc_info or
|
||||||
|
* gc_profile_record_flag in gc.c.
|
||||||
|
*/
|
||||||
|
RB_DEBUG_COUNTER(gc_count)
|
||||||
|
RB_DEBUG_COUNTER(gc_minor_newobj)
|
||||||
|
RB_DEBUG_COUNTER(gc_minor_malloc)
|
||||||
|
RB_DEBUG_COUNTER(gc_minor_method)
|
||||||
|
RB_DEBUG_COUNTER(gc_minor_capi)
|
||||||
|
RB_DEBUG_COUNTER(gc_minor_stress)
|
||||||
|
RB_DEBUG_COUNTER(gc_major_nofree)
|
||||||
|
RB_DEBUG_COUNTER(gc_major_oldgen)
|
||||||
|
RB_DEBUG_COUNTER(gc_major_shady)
|
||||||
|
RB_DEBUG_COUNTER(gc_major_force)
|
||||||
|
|
||||||
/* object allocation counts:
|
/* object allocation counts:
|
||||||
*
|
*
|
||||||
* * obj_newobj: newobj counts
|
* * obj_newobj: newobj counts
|
||||||
|
|
17
gc.c
17
gc.c
|
@ -6536,6 +6536,23 @@ gc_start(rb_objspace_t *objspace, int reason)
|
||||||
reason,
|
reason,
|
||||||
do_full_mark, !is_incremental_marking(objspace), objspace->flags.immediate_sweep);
|
do_full_mark, !is_incremental_marking(objspace), objspace->flags.immediate_sweep);
|
||||||
|
|
||||||
|
#if USE_DEBUG_COUNTER
|
||||||
|
RB_DEBUG_COUNTER_INC(gc_count);
|
||||||
|
if (reason & GPR_FLAG_MAJOR_MASK) {
|
||||||
|
(void)RB_DEBUG_COUNTER_INC_IF(gc_major_nofree, reason & GPR_FLAG_MAJOR_BY_NOFREE);
|
||||||
|
(void)RB_DEBUG_COUNTER_INC_IF(gc_major_oldgen, reason & GPR_FLAG_MAJOR_BY_OLDGEN);
|
||||||
|
(void)RB_DEBUG_COUNTER_INC_IF(gc_major_shady, reason & GPR_FLAG_MAJOR_BY_SHADY);
|
||||||
|
(void)RB_DEBUG_COUNTER_INC_IF(gc_major_force, reason & GPR_FLAG_MAJOR_BY_FORCE);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
(void)RB_DEBUG_COUNTER_INC_IF(gc_minor_newobj, reason & GPR_FLAG_NEWOBJ);
|
||||||
|
(void)RB_DEBUG_COUNTER_INC_IF(gc_minor_malloc, reason & GPR_FLAG_MALLOC);
|
||||||
|
(void)RB_DEBUG_COUNTER_INC_IF(gc_minor_method, reason & GPR_FLAG_METHOD);
|
||||||
|
(void)RB_DEBUG_COUNTER_INC_IF(gc_minor_capi, reason & GPR_FLAG_CAPI);
|
||||||
|
(void)RB_DEBUG_COUNTER_INC_IF(gc_minor_stress, reason & GPR_FLAG_NEWOBJ);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
objspace->profile.count++;
|
objspace->profile.count++;
|
||||||
objspace->profile.latest_gc_info = reason;
|
objspace->profile.latest_gc_info = reason;
|
||||||
objspace->profile.total_allocated_objects_at_gc_start = objspace->total_allocated_objects;
|
objspace->profile.total_allocated_objects_at_gc_start = objspace->total_allocated_objects;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче