[#38563] [Bug #1556] irb does not save history from 1.8.7-p83 and later — Nobuhiro IMAI <redmine@...>

Bug #1556: irb does not save history from 1.8.7-p83 and later

11 messages 2009/06/02

[#38571] [Bug #1582] IO.new Raises Other Errors between 1.8 and 1.9 — "ujihisa ." <redmine@...>

Bug #1582: IO.new Raises Other Errors between 1.8 and 1.9

15 messages 2009/06/05

[#38607] [Feature: trunk] GC.stat — SASADA Koichi <ko1@...>

 ささだです.

21 messages 2009/06/14

[#38608] Fixnum#fdiv — Tadayoshi Funaba <tadf@...>

Bignum#fdiv には大きな数である場合の配慮があるようですが、Fixnum ではな

23 messages 2009/06/14
[#38636] Re: Fixnum#fdiv — Tadayoshi Funaba <tadf@...> 2009/06/15

fdiv では2つの異る解釈が混在しているように見えます。

[#38638] Re: Fixnum#fdiv — Yukihiro Matsumoto <matz@...> 2009/06/15

まつもと ゆきひろです

[#38639] Re: Fixnum#fdiv — Tadayoshi Funaba <tadf@...> 2009/06/15

> えーと、設計者は「fdivは結果がfloatになるdiv」くらいしか考え

[#38640] Re: Fixnum#fdiv — Yukihiro Matsumoto <matz@...> 2009/06/15

まつもと ゆきひろです

[#38641] Re: Fixnum#fdiv — Tadayoshi Funaba <tadf@...> 2009/06/15

> ふむ。「中途半端」というのはfixnumとbignumで食い違うと言う意

[#38657] Re: Fixnum#fdiv — Tadayoshi Funaba <tadf@...> 2009/06/16

> > ふむ。「中途半端」というのはfixnumとbignumで食い違うと言う意

[#38659] Re: Fixnum#fdiv — Yukihiro Matsumoto <matz@...> 2009/06/16

まつもと ゆきひろです

[#38660] Re: Fixnum#fdiv — Tadayoshi Funaba <tadf@...> 2009/06/16

> 私が気にしているのは「挙動の理解しやすさ」ですね。

[#38701] [Bug #1676] only last "return" is traced by set_trace_func — _ wanabe <redmine@...>

Bug #1676: only last "return" is traced by set_trace_func

10 messages 2009/06/22

[ruby-dev:38583] [Feature: trunk] GC.time

From: SASADA Koichi <ko1@...>
Date: 2009-06-10 01:49:47 UTC
List: ruby-dev #38583
 ささだです.

 今まで何回 GC をやったか調べるための GC.count というのがあるのですが,
これまでの GC にかかった時間を返す GC.time というメソッドを追加するのは
どうでしょうか.

 GC::Profiler を使えば,似たようなことは出来るような気がするのですが,
この用途のためだけに使うのはちょっと重いし,整形された文字列でしか結果が
取れないので使いづらいので....


Index: gc.c
===================================================================
--- gc.c	(リビジョン 23657)
+++ gc.c	(作業コピー)
@@ -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");


-- 
// SASADA Koichi at atdot dot net

In This Thread

Prev Next