[前][次][番号順一覧][スレッド一覧]

ruby-changes:29441

From: ko1 <ko1@a...>
Date: Thu, 20 Jun 2013 21:20:53 +0900 (JST)
Subject: [ruby-changes:29441] ko1:r41493 (trunk): * gc.c (rgengc_rememberset_mark): record

ko1	2013-06-20 21:20:27 +0900 (Thu, 20 Jun 2013)

  New Revision: 41493

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=41493

  Log:
    * gc.c (rgengc_rememberset_mark): record
      (1) normal objects count in remember set
      (2) shady objects count in remember set
      each GC timing.
    * gc.c (gc_profile_record_get): enable to access above information
      and REMOVING_OBJECTS, EMPTY_OBJECTS.

  Modified files:
    trunk/ChangeLog
    trunk/gc.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 41492)
+++ ChangeLog	(revision 41493)
@@ -1,3 +1,13 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Thu Jun 20 21:17:19 2013  Koichi Sasada  <ko1@a...>
+
+	* gc.c (rgengc_rememberset_mark): record
+	  (1) normal objects count in remember set
+	  (2) shady objects count in remember set
+	  each GC timing.
+
+	* gc.c (gc_profile_record_get): enable to access above information
+	  and REMOVING_OBJECTS, EMPTY_OBJECTS.
+
 Thu Jun 20 18:29:26 2013  Koichi Sasada  <ko1@a...>
 
 	* benchmark/gc/gcbench.rb: Do not use GC::Profiler::disable because
Index: gc.c
===================================================================
--- gc.c	(revision 41492)
+++ gc.c	(revision 41493)
@@ -195,6 +195,11 @@ typedef struct gc_profile_record { https://github.com/ruby/ruby/blob/trunk/gc.c#L195
     size_t removing_objects;
     size_t empty_objects;
 #endif
+
+#if RGENGC_PROFILE > 0
+    size_t remembered_normal_objects;
+    size_t remembered_shady_objects;
+#endif
 } gc_profile_record;
 
 #if defined(_MSC_VER) || defined(__BORLANDC__) || defined(__CYGWIN__)
@@ -344,6 +349,10 @@ typedef struct rb_objspace { https://github.com/ruby/ruby/blob/trunk/gc.c#L349
 	size_t promote_operation_count;
 	size_t remembered_normal_object_count;
 	size_t remembered_shady_object_count;
+
+	/* temporal profiling space */
+	size_t remembered_normal_objects;
+	size_t remembered_shady_objects;
 #if RGENGC_PROFILE >= 2
 	size_t generated_normal_object_count_types[RUBY_T_MASK];
 	size_t generated_shady_object_count_types[RUBY_T_MASK];
@@ -3765,7 +3774,10 @@ rgengc_rememberset_mark(rb_objspace_t *o https://github.com/ruby/ruby/blob/trunk/gc.c#L3774
     }
 
     rgengc_report(2, objspace, "rgengc_rememberset_mark: clear_count: %"PRIdSIZE", shady_object_count: %"PRIdSIZE"\n", clear_count, shady_object_count);
-
+#if RGENGC_PROFILE > 0
+    objspace->profile.remembered_normal_objects = clear_count;
+    objspace->profile.remembered_shady_objects = shady_object_count;
+#endif
     return shady_object_count;
 }
 
@@ -5115,6 +5127,12 @@ gc_prof_set_heap_info(rb_objspace_t *obj https://github.com/ruby/ruby/blob/trunk/gc.c#L5127
     record->heap_live_objects = live;
     record->heap_free_objects = total - live;
 #endif
+
+#if RGENGC_PROFILE > 0
+    record->remembered_normal_objects = objspace->profile.remembered_normal_objects;
+    record->remembered_shady_objects = objspace->profile.remembered_shady_objects;
+#endif
+
     record->heap_total_objects = total;
     record->heap_use_size = live * sizeof(RVALUE);
     record->heap_total_size = total * sizeof(RVALUE);
@@ -5239,8 +5257,17 @@ gc_profile_record_get(void) https://github.com/ruby/ruby/blob/trunk/gc.c#L5257
         rb_hash_aset(prof, ID2SYM(rb_intern("HEAP_USE_SLOTS")), SIZET2NUM(objspace->profile.record[i].heap_use_slots));
         rb_hash_aset(prof, ID2SYM(rb_intern("HEAP_LIVE_OBJECTS")), SIZET2NUM(objspace->profile.record[i].heap_live_objects));
         rb_hash_aset(prof, ID2SYM(rb_intern("HEAP_FREE_OBJECTS")), SIZET2NUM(objspace->profile.record[i].heap_free_objects));
+
+	rb_hash_aset(prof, ID2SYM(rb_intern("REMOVING_OBJECTS")), SIZET2NUM(objspace->profile.record[i].removing_objects));
+	rb_hash_aset(prof, ID2SYM(rb_intern("EMPTY_OBJECTS")), SIZET2NUM(objspace->profile.record[i].empty_objects));
+
 	rb_hash_aset(prof, ID2SYM(rb_intern("HAVE_FINALIZE")), (objspace->profile.record[i].flags & GPR_FLAG_HAVE_FINALIZE) ? Qtrue : Qfalse);
 #endif
+
+#if RGENGC_PROFILE > 0
+	rb_hash_aset(prof, ID2SYM(rb_intern("REMEMBED_NORMAL_OBJECTS")), SIZET2NUM(objspace->profile.record[i].remembered_normal_objects));
+	rb_hash_aset(prof, ID2SYM(rb_intern("REMEMBED_SHADY_OBJECTS")), SIZET2NUM(objspace->profile.record[i].remembered_shady_objects));
+#endif
 	rb_ary_push(gc_profile, prof);
     }
 

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]