mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* gc.c (gc_profile_result): use rb_str_catf.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18525 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
5ade93542f
commit
5b3278b74a
2 changed files with 18 additions and 17 deletions
|
@ -1,3 +1,7 @@
|
||||||
|
Tue Aug 12 16:23:32 2008 Narihiro Nakamura <authorNari@gmail.com>
|
||||||
|
|
||||||
|
* gc.c (gc_profile_result): use rb_str_catf.
|
||||||
|
|
||||||
Tue Aug 12 16:13:45 2008 Tanaka Akira <akr@fsij.org>
|
Tue Aug 12 16:13:45 2008 Tanaka Akira <akr@fsij.org>
|
||||||
|
|
||||||
* transcode_data.h (TRANSCODE_ERROR): removed.
|
* transcode_data.h (TRANSCODE_ERROR): removed.
|
||||||
|
|
31
gc.c
31
gc.c
|
@ -2709,24 +2709,20 @@ gc_profile_result(void)
|
||||||
{
|
{
|
||||||
rb_objspace_t *objspace = &rb_objspace;
|
rb_objspace_t *objspace = &rb_objspace;
|
||||||
VALUE record = gc_profile_record_get();
|
VALUE record = gc_profile_record_get();
|
||||||
VALUE result = rb_str_new2("");
|
VALUE result;
|
||||||
int i;
|
int i;
|
||||||
char buf[1024];
|
|
||||||
|
|
||||||
if(objspace->profile.run && objspace->profile.count) {
|
if (objspace->profile.run && objspace->profile.count) {
|
||||||
sprintf(buf, "GC %d invokes.\n", NUM2INT(gc_count(0)));
|
result = rb_sprintf("GC %d invokes.\n", NUM2INT(gc_count(0)));
|
||||||
rb_str_cat2(result, buf);
|
|
||||||
rb_str_cat2(result, "Index Invoke Time(sec) Use Size(byte) Total Size(byte) Total Object GC Time(ms)\n");
|
rb_str_cat2(result, "Index Invoke Time(sec) Use Size(byte) Total Size(byte) Total Object GC Time(ms)\n");
|
||||||
for(i = 0; i < (int)RARRAY_LEN(record); i++) {
|
for (i = 0; i < (int)RARRAY_LEN(record); i++) {
|
||||||
VALUE r = RARRAY_PTR(record)[i];
|
VALUE r = RARRAY_PTR(record)[i];
|
||||||
memset(buf, 0, 1024);
|
rb_str_catf(result, "%5d %19.3f %20d %20d %20d %30.20f\n",
|
||||||
sprintf(buf, "%5d %19.3f %20d %20d %20d %30.20f\n",
|
i+1, NUM2DBL(rb_hash_aref(r, ID2SYM(rb_intern("GC_INVOKE_TIME")))),
|
||||||
i+1, NUM2DBL(rb_hash_aref(r, ID2SYM(rb_intern("GC_INVOKE_TIME")))),
|
NUM2INT(rb_hash_aref(r, ID2SYM(rb_intern("HEAP_USE_SIZE")))),
|
||||||
NUM2INT(rb_hash_aref(r, ID2SYM(rb_intern("HEAP_USE_SIZE")))),
|
NUM2INT(rb_hash_aref(r, ID2SYM(rb_intern("HEAP_TOTAL_SIZE")))),
|
||||||
NUM2INT(rb_hash_aref(r, ID2SYM(rb_intern("HEAP_TOTAL_SIZE")))),
|
NUM2INT(rb_hash_aref(r, ID2SYM(rb_intern("HEAP_TOTAL_OBJECTS")))),
|
||||||
NUM2INT(rb_hash_aref(r, ID2SYM(rb_intern("HEAP_TOTAL_OBJECTS")))),
|
NUM2DBL(rb_hash_aref(r, ID2SYM(rb_intern("GC_TIME"))))*100);
|
||||||
NUM2DBL(rb_hash_aref(r, ID2SYM(rb_intern("GC_TIME"))))*100);
|
|
||||||
rb_str_cat2(result, buf);
|
|
||||||
}
|
}
|
||||||
#if GC_PROFILE_MORE_DETAIL
|
#if GC_PROFILE_MORE_DETAIL
|
||||||
rb_str_cat2(result, "\n\n");
|
rb_str_cat2(result, "\n\n");
|
||||||
|
@ -2734,18 +2730,19 @@ gc_profile_result(void)
|
||||||
rb_str_cat2(result, "Index Allocate Increase Allocate Limit Use Slot Have Finalize Mark Time(ms) Sweep Time(ms)\n");
|
rb_str_cat2(result, "Index Allocate Increase Allocate Limit Use Slot Have Finalize Mark Time(ms) Sweep Time(ms)\n");
|
||||||
for (i = 0; i < (int)RARRAY_LEN(record); i++) {
|
for (i = 0; i < (int)RARRAY_LEN(record); i++) {
|
||||||
VALUE r = RARRAY_PTR(record)[i];
|
VALUE r = RARRAY_PTR(record)[i];
|
||||||
memset(buf, 0, 1024);
|
rb_str_catf(result, "%5d %17d %17d %9d %14s %25.20f %25.20f\n",
|
||||||
sprintf(buf, "%5d %17d %17d %9d %14s %25.20f %25.20f\n",
|
|
||||||
i+1, NUM2INT(rb_hash_aref(r, ID2SYM(rb_intern("ALLOCATE_INCREASE")))),
|
i+1, NUM2INT(rb_hash_aref(r, ID2SYM(rb_intern("ALLOCATE_INCREASE")))),
|
||||||
NUM2INT(rb_hash_aref(r, ID2SYM(rb_intern("ALLOCATE_LIMIT")))),
|
NUM2INT(rb_hash_aref(r, ID2SYM(rb_intern("ALLOCATE_LIMIT")))),
|
||||||
NUM2INT(rb_hash_aref(r, ID2SYM(rb_intern("HEAP_USE_SLOTS")))),
|
NUM2INT(rb_hash_aref(r, ID2SYM(rb_intern("HEAP_USE_SLOTS")))),
|
||||||
rb_hash_aref(r, ID2SYM(rb_intern("HAVE_FINALIZE")))? "true" : "false",
|
rb_hash_aref(r, ID2SYM(rb_intern("HAVE_FINALIZE")))? "true" : "false",
|
||||||
NUM2DBL(rb_hash_aref(r, ID2SYM(rb_intern("GC_MARK_TIME"))))*100,
|
NUM2DBL(rb_hash_aref(r, ID2SYM(rb_intern("GC_MARK_TIME"))))*100,
|
||||||
NUM2DBL(rb_hash_aref(r, ID2SYM(rb_intern("GC_SWEEP_TIME"))))*100);
|
NUM2DBL(rb_hash_aref(r, ID2SYM(rb_intern("GC_SWEEP_TIME"))))*100);
|
||||||
rb_str_cat2(result, buf);
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
result = rb_str_new2("");
|
||||||
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue