gc.c: use size_t and no header if next_index == 0
* gc.c (gc_profile_dump_on): use size_t to get rid of overflow and show the header when next_index > 0, instead of next_index != 1. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40889 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
a815b56d84
commit
11650a6ab9
@ -1,3 +1,8 @@
|
|||||||
|
Wed May 22 16:50:18 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
|
* gc.c (gc_profile_dump_on): use size_t to get rid of overflow and
|
||||||
|
show the header when next_index > 0, instead of next_index != 1.
|
||||||
|
|
||||||
Wed May 22 15:18:59 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
Wed May 22 15:18:59 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
* win32/win32.c (setup_overlapped): check the error code in addition
|
* win32/win32.c (setup_overlapped): check the error code in addition
|
||||||
|
15
gc.c
15
gc.c
@ -4996,10 +4996,10 @@ static void
|
|||||||
gc_profile_dump_on(VALUE out, VALUE (*append)(VALUE, VALUE))
|
gc_profile_dump_on(VALUE out, VALUE (*append)(VALUE, VALUE))
|
||||||
{
|
{
|
||||||
rb_objspace_t *objspace = &rb_objspace;
|
rb_objspace_t *objspace = &rb_objspace;
|
||||||
int count = (int)objspace->profile.next_index - 1;
|
size_t count = objspace->profile.next_index;
|
||||||
|
|
||||||
if (objspace->profile.run && count) {
|
if (objspace->profile.run && count /* > 1 */) {
|
||||||
int i, index = 1;
|
size_t i;
|
||||||
const gc_profile_record *record;
|
const gc_profile_record *record;
|
||||||
|
|
||||||
append(out, rb_sprintf("GC %"PRIuSIZE" invokes.\n", objspace->count));
|
append(out, rb_sprintf("GC %"PRIuSIZE" invokes.\n", objspace->count));
|
||||||
@ -5007,19 +5007,18 @@ gc_profile_dump_on(VALUE out, VALUE (*append)(VALUE, VALUE))
|
|||||||
|
|
||||||
for (i = 0; i < count; i++) {
|
for (i = 0; i < count; i++) {
|
||||||
record = &objspace->profile.record[i];
|
record = &objspace->profile.record[i];
|
||||||
append(out, rb_sprintf("%5d %19.3f %20"PRIuSIZE" %20"PRIuSIZE" %20"PRIuSIZE" %30.20f\n",
|
append(out, rb_sprintf("%5"PRIdSIZE" %19.3f %20"PRIuSIZE" %20"PRIuSIZE" %20"PRIuSIZE" %30.20f\n",
|
||||||
index++, record->gc_invoke_time, record->heap_use_size,
|
i+1, record->gc_invoke_time, record->heap_use_size,
|
||||||
record->heap_total_size, record->heap_total_objects, record->gc_time*1000));
|
record->heap_total_size, record->heap_total_objects, record->gc_time*1000));
|
||||||
}
|
}
|
||||||
#if GC_PROFILE_MORE_DETAIL
|
#if GC_PROFILE_MORE_DETAIL
|
||||||
append(out, rb_str_new_cstr("\n\n" \
|
append(out, rb_str_new_cstr("\n\n" \
|
||||||
"More detail.\n" \
|
"More detail.\n" \
|
||||||
"Index Flags Allocate Increase Allocate Limit Use Slot Mark Time(ms) Sweep Time(ms)\n"));
|
"Index Flags Allocate Increase Allocate Limit Use Slot Mark Time(ms) Sweep Time(ms)\n"));
|
||||||
index = 1;
|
|
||||||
for (i = 0; i < count; i++) {
|
for (i = 0; i < count; i++) {
|
||||||
record = &objspace->profile.record[i];
|
record = &objspace->profile.record[i];
|
||||||
append(out, rb_sprintf("%5d %c/%c/%s%c %17"PRIuSIZE" %17"PRIuSIZE" %9"PRIuSIZE" %25.20f %25.20f\n",
|
append(out, rb_sprintf("%5"PRIdSIZE" %c/%c/%s%c %17"PRIuSIZE" %17"PRIuSIZE" %9"PRIuSIZE" %25.20f %25.20f\n",
|
||||||
index++,
|
i+1,
|
||||||
(record->flags & GPR_FLAG_MINOR) ? '-' : '+',
|
(record->flags & GPR_FLAG_MINOR) ? '-' : '+',
|
||||||
(record->flags & GPR_FLAG_HAVE_FINALIZE) ? 'F' : '.',
|
(record->flags & GPR_FLAG_HAVE_FINALIZE) ? 'F' : '.',
|
||||||
(record->flags & GPR_FLAG_NEWOBJ) ? "NEWOBJ" :
|
(record->flags & GPR_FLAG_NEWOBJ) ? "NEWOBJ" :
|
||||||
|
Loading…
x
Reference in New Issue
Block a user