[Feature: trunk] GC.time

[email protected]$G$9!%e(B

e$B!!:#$^$G2?2se(B GC e$B$r$d$C$?$+D4$Y$k$?$a$Ne(B GC.count
e$B$H$$$&$N$,$"$k$N$G$9$,!$e(B
e$B$3$l$^$G$Ne(B GC e$B$K$+$+$C$?;~4V$rJV$9e(B GC.time
e$B$H$$$&%a%=%C%I$rDI2C$9$k$N$Oe(B
e$B$I$&$G$7$g$&$+!%e(B

e$B!!e(BGC::Profiler
e$B$r;H$($P!$;w$?$h$&$J$3$H$O=PMh$k$h$&$J5$$,$9$k$N$G$9$,!$e(B
[email protected]$1$K;H$&[email protected]$5$l$?J8;zNs$G$7$+7k2L$,e(B
e$B<h$l$J$$$N$G;H$$$E$i$$$N$Ge(B…e$B!%e(B

Index: gc.c

— gc.c (e$B%j%S%8%g%se(B 23657)
+++ gc.c (e$B:n6H%3%T!<e(B)
@@ -356,6 +356,7 @@
} profile;
struct gc_list *global_list;
unsigned int count;

  • double time;
    int gc_stress;
    } rb_objspace_t;

@@ -2207,6 +2208,8 @@
{
struct gc_list *list;
rb_thread_t *th = GET_THREAD();

  • double invoke_time = getrusage_time();

  • INIT_GC_PROF_PARAMS;

    if (GC_NOTIFY) printf(“start garbage_collect()\n”);
    @@ -2286,6 +2289,9 @@

    GC_PROF_TIMER_STOP;
    if (GC_NOTIFY) printf(“end garbage_collect()\n”);

  • objspace->time += getrusage_time() - invoke_time;

  • return Qtrue;
    }

@@ -2950,6 +2956,12 @@
return UINT2NUM((&rb_objspace)->count);
}

+static VALUE
+gc_time(VALUE self)
+{

  • return DBL2NUM((&rb_objspace)->time);
    +}

#if CALC_EXACT_MALLOC_SIZE
/*

  • call-seq:
    @@ -3122,6 +3134,7 @@
    rb_define_singleton_method(rb_mGC, “stress”, gc_stress_get, 0);
    rb_define_singleton_method(rb_mGC, “stress=”, gc_stress_set, 1);
    rb_define_singleton_method(rb_mGC, “count”, gc_count, 0);
  • rb_define_singleton_method(rb_mGC, “time”, gc_time, 0);
    rb_define_method(rb_mGC, “garbage_collect”, rb_gc_start, 0);

    rb_mProfiler = rb_define_module_under(rb_mGC, “Profiler”);

e$B%A%1%C%He(B #1596 e$B$,99?7$5$l$^$7$?!#e(B (by Yusuke E.)

e$B%9%F!<%?%9e(B Opene$B$+$ie(BClosede$B$KJQ99e(B

e$B1sF#$G$9!#e(B

e$B!!:#$^$G2?2se(B GC e$B$r$d$C$?$+D4$Y$k$?$a$Ne(B GC.count e$B$H$$$&$N$,$"$k$N$G$9$,!$e(B
e$B$3$l$^$G$Ne(B GC e$B$K$+$+$C$?;~4V$rJV$9e(B GC.time e$B$H$$$&%a%=%C%I$rDI2C$9$k$N$Oe(B
e$B$I$&$G$7$g$&$+!%e(B

#2480 e$B$Ge(B GC::Profiler.total_time e$B$,F3F~$5$l$?$N$G!"e(Bclose
e$B$7$^$9!#e(B

e$B$;$C$+$/$J$N$G2?2s$+;H$C$F$$?7P83$r=q$$$F$$-$^$9$H!"@8$-$F$$$ke(B
e$B%
%V%8%’%/%H$,BgNL$K$"$ke(B (= e$B0l2s$"$?$j$Ne(BGC
e$B$K;~4V$,$+$+$ke(B) e$B$H$-$Oe(B
[email protected]:EY$,$G$k$N$G$9$,!"$=$N>l8B$j$N%*%V%8%’%/%H$,$$$C$Q$$e(B
[email protected]@.$5$l$ke(B (= e$BC;$$e(B GC e$B$,$$$C$Q$$Av$ke(B)
e$B$H$-$O8m:9$,C
@Q$5$l$FA4A3e(B
e$B$"$F$K$J$i$J$$46$8$G$9!#e(B


Yusuke E. [email protected]

http://redmine.ruby-lang.org/issues/show/1596

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs