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

ruby-changes:29455

From: ko1 <ko1@a...>
Date: Fri, 21 Jun 2013 07:38:18 +0900 (JST)
Subject: [ruby-changes:29455] ko1:r41507 (trunk): * gc.c (gc_profile_record::oldgen_objects): added.

ko1	2013-06-21 07:38:08 +0900 (Fri, 21 Jun 2013)

  New Revision: 41507

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

  Log:
    * gc.c (gc_profile_record::oldgen_objects): added.
    * gc.c (gc_profile_dump_on): print the following infomation:
    * Living object counts
    * Free object counts
      If RGENGC_PROFILE > 0 then
    * Oldgen object counts
    * Remembered normal object counts
    * Remembered shady object counts

  Modified files:
    trunk/ChangeLog
    trunk/gc.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 41506)
+++ ChangeLog	(revision 41507)
@@ -1,3 +1,15 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Fri Jun 21 07:34:47 2013  Koichi Sasada  <ko1@a...>
+
+	* gc.c (gc_profile_record::oldgen_objects): added.
+
+	* gc.c (gc_profile_dump_on): print the following infomation:
+	  * Living object counts
+	  * Free object counts
+	  If RGENGC_PROFILE > 0 then
+	  * Oldgen object counts
+	  * Remembered normal object counts
+	  * Remembered shady object counts
+
 Fri Jun 21 06:43:59 2013  Tanaka Akira  <akr@f...>
 
 	* bignum.c (rb_ull2big): Refactored.
Index: gc.c
===================================================================
--- gc.c	(revision 41506)
+++ gc.c	(revision 41507)
@@ -148,7 +148,7 @@ void rb_gcdebug_print_obj_condition(VALU https://github.com/ruby/ruby/blob/trunk/gc.c#L148
 #define GC_PROFILE_MORE_DETAIL 0
 #endif
 #ifndef GC_ENABLE_LAZY_SWEEP
-#define GC_ENABLE_LAZY_SWEEP 1
+#define GC_ENABLE_LAZY_SWEEP 0
 #endif
 #ifndef CALC_EXACT_MALLOC_SIZE
 #define CALC_EXACT_MALLOC_SIZE 0
@@ -197,6 +197,7 @@ typedef struct gc_profile_record { https://github.com/ruby/ruby/blob/trunk/gc.c#L197
 #endif
 
 #if RGENGC_PROFILE > 0
+    size_t oldgen_objects;
     size_t remembered_normal_objects;
     size_t remembered_shady_objects;
 #endif
@@ -5133,6 +5134,7 @@ gc_prof_set_heap_info(rb_objspace_t *obj https://github.com/ruby/ruby/blob/trunk/gc.c#L5134
 #endif
 
 #if RGENGC_PROFILE > 0
+    record->oldgen_objects = objspace->rgengc.oldgen_object_count;
     record->remembered_normal_objects = objspace->profile.remembered_normal_objects;
     record->remembered_shady_objects = objspace->profile.remembered_shady_objects;
 #endif
@@ -5269,6 +5271,7 @@ gc_profile_record_get(void) https://github.com/ruby/ruby/blob/trunk/gc.c#L5271
 #endif
 
 #if RGENGC_PROFILE > 0
+	rb_hash_aset(prof, ID2SYM(rb_intern("OLDGEN_OBJECTS")), SIZET2NUM(objspace->profile.record[i].oldgen_objects));
 	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
@@ -5297,6 +5300,7 @@ gc_profile_dump_on(VALUE out, VALUE (*ap https://github.com/ruby/ruby/blob/trunk/gc.c#L5300
 				   i+1, record->gc_invoke_time, record->heap_use_size,
 				   record->heap_total_size, record->heap_total_objects, record->gc_time*1000));
 	}
+
 #if GC_PROFILE_MORE_DETAIL
 	append(out, rb_str_new_cstr("\n\n" \
 				    "More detail.\n" \
@@ -5305,14 +5309,24 @@ gc_profile_dump_on(VALUE out, VALUE (*ap https://github.com/ruby/ruby/blob/trunk/gc.c#L5309
 #if CALC_EXACT_MALLOC_SIZE
 				    "  Allocated Size"
 #endif
-				    "  Use Slot     Mark Time(ms)    Sweep Time(ms)  Prepare Time(ms)  Removing Obj.  Empty Obj.\n"));
+				    "  Use Slot     Mark Time(ms)    Sweep Time(ms)  Prepare Time(ms)  LivingObj    FreeObj RemovedObj   EmptyObj"
+#if RGENGC_PROFILE
+				    " OldgenObj RemNormObj RemShadObj"
+#endif
+				    "\n"));
+
 	for (i = 0; i < count; i++) {
 	    record = &objspace->profile.record[i];
 	    append(out, rb_sprintf("%5"PRIdSIZE" %c/%c/%6s%c %13"PRIuSIZE" %15"PRIuSIZE
 #if CALC_EXACT_MALLOC_SIZE
 				   " %15"PRIuSIZE
 #endif
-				   " %9"PRIuSIZE" %17.12f %17.12f %17.12f %14"PRIuSIZE" %11"PRIuSIZE" \n",
+				   " %9"PRIuSIZE" %17.12f %17.12f %17.12f %10"PRIuSIZE" %10"PRIuSIZE" %10"PRIuSIZE" %10"PRIuSIZE
+#if RGENGC_PROFILE
+				   "%10"PRIuSIZE" %10"PRIuSIZE" %10"PRIuSIZE"\n"
+#endif
+				   ,
+				   
 				   i+1,
 				   (record->flags & GPR_FLAG_MINOR) ? '-' : '+',
 				   (record->flags & GPR_FLAG_HAVE_FINALIZE) ? 'F' : '.',
@@ -5326,10 +5340,20 @@ gc_profile_dump_on(VALUE out, VALUE (*ap https://github.com/ruby/ruby/blob/trunk/gc.c#L5340
 				   record->allocated_size,
 #endif
 				   record->heap_use_slots,
-				   record->gc_mark_time*1000, record->gc_sweep_time*1000,
+				   record->gc_mark_time*1000,
+				   record->gc_sweep_time*1000,
 				   record->prepare_time*1000,
+
+				   record->heap_live_objects,
+				   record->heap_free_objects,
 				   record->removing_objects,
 				   record->empty_objects
+#if RGENGC_PROFILE
+				   ,
+				   record->oldgen_objects,
+				   record->remembered_normal_objects,
+				   record->remembered_shady_objects
+#endif
 		       ));
 	}
 #endif

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

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