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

ruby-changes:28818

From: ko1 <ko1@a...>
Date: Tue, 21 May 2013 16:27:43 +0900 (JST)
Subject: [ruby-changes:28818] ko1:r40870 (trunk): * gc.c (gc_profile_dump_on): `count' should be (int) because it

ko1	2013-05-21 16:27:32 +0900 (Tue, 21 May 2013)

  New Revision: 40870

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

  Log:
    * gc.c (gc_profile_dump_on): `count' should be (int) because it
      can be negative number.
      And use pointer for `record' (don't copy).

  Modified files:
    trunk/ChangeLog
    trunk/gc.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 40869)
+++ ChangeLog	(revision 40870)
@@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Tue May 21 16:25:05 2013  Koichi Sasada  <ko1@a...>
+
+	* gc.c (gc_profile_dump_on): `count' should be (int) because it 
+	  can be negative number.
+	  And use pointer for `record' (don't copy).
+
 Tue May 21 03:11:18 2013  Nobuyoshi Nakada  <nobu@r...>
 
 	* dir.c (dir_each): compose HFS file names from
Index: gc.c
===================================================================
--- gc.c	(revision 40869)
+++ gc.c	(revision 40870)
@@ -4929,37 +4929,38 @@ static void https://github.com/ruby/ruby/blob/trunk/gc.c#L4929
 gc_profile_dump_on(VALUE out, VALUE (*append)(VALUE, VALUE))
 {
     rb_objspace_t *objspace = &rb_objspace;
-    size_t count = objspace->profile.next_index - 1;
+    int count = (int)objspace->profile.next_index - 1;
 
     if (objspace->profile.run && count) {
-	int index = 1;
-	size_t i;
-	gc_profile_record r;
+	int i, index = 1;
+	const gc_profile_record *record;
+
 	append(out, rb_sprintf("GC %"PRIuSIZE" invokes.\n", objspace->count));
 	append(out, rb_str_new_cstr("Index    Invoke Time(sec)       Use Size(byte)     Total Size(byte)         Total Object                    GC Time(ms)\n"));
+
 	for (i = 0; i < count; i++) {
-	    r = objspace->profile.record[i];
+	    record = &objspace->profile.record[i];
 #if !GC_PROFILE_MORE_DETAIL
-            if (r.is_marked) {
+	    if (record->is_marked) {
 #endif
 		append(out, rb_sprintf("%5d %19.3f %20"PRIuSIZE" %20"PRIuSIZE" %20"PRIuSIZE" %30.20f\n",
-			index++, r.gc_invoke_time, r.heap_use_size,
-			r.heap_total_size, r.heap_total_objects, r.gc_time*1000));
+				       index++, 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
-            }
+	    }
 #endif
 	}
 #if GC_PROFILE_MORE_DETAIL
 	append(out, rb_str_new_cstr("\n\n" \
-		"More detail.\n" \
-		"Index Allocate Increase    Allocate Limit  Use Slot  Have Finalize             Mark Time(ms)            Sweep Time(ms)\n"));
-        index = 1;
+				    "More detail.\n" \
+				    "Index Allocate Increase    Allocate Limit  Use Slot  Have Finalize             Mark Time(ms)            Sweep Time(ms)\n"));
+	index = 1;
 	for (i = 0; i < count; i++) {
 	    r = objspace->profile.record[i];
 	    append(out, rb_sprintf("%5d %17"PRIuSIZE" %17"PRIuSIZE" %9"PRIuSIZE" %14s %25.20f %25.20f\n",
-			index++, r.allocate_increase, r.allocate_limit,
-			r.heap_use_slots, (r.have_finalize ? "true" : "false"),
-			r.gc_mark_time*1000, r.gc_sweep_time*1000));
+				   index++, record->allocate_increase, record->allocate_limit,
+				   record->heap_use_slots, (record->have_finalize ? "true" : "false"),
+				   record->gc_mark_time*1000, record->gc_sweep_time*1000));
 	}
 #endif
     }

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

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