[#42369] [BUG: trunk] Lazy sweep and ObjectSpace.each_object — SASADA Koichi <ko1@...>

 ささだです。

14 messages 2010/10/13

[#42375] [Ruby 1.9-Feature#3946][Open] Array#packのqQ指定子に機種依存サイズフラグ!を追加 — Yui NARUSE <redmine@...>

Feature #3946: Array#packのqQ指定子に機種依存サイズフラグ!を追加

19 messages 2010/10/14
[#42380] Re: [Ruby 1.9-Feature#3946][Open] Array#packのqQ指定子に機種依存サイズフラグ!を追加 — Tanaka Akira <akr@...> 2010/10/14

2010年10月14日15:36 Yui NARUSE <redmine@ruby-lang.org>:

[#42381] Re: [Ruby 1.9-Feature#3946][Open] Array#packのqQ指定子に機種依存サイズフラグ!を追加 — "NARUSE, Yui" <naruse@...> 2010/10/14

(2010/10/14 21:07), Tanaka Akira wrote:

[#42619] [Ruby 1.9-Feature#3946][Open] Array#packのqQ指定子に機種依存サイズフラグ!を追加 — Usaku NAKAMURA <redmine@...> 2010/11/25

チケット #3946 が更新されました。 (by Usaku NAKAMURA)

[#42376] [Ruby 1.9-Feature#3947][Open] Array#packのにエンディアン指定修飾子</>を追加 — Yui NARUSE <redmine@...>

Feature #3947: Array#packのにエンディアン指定修飾子</>を追加

9 messages 2010/10/14

[#42464] [Ruby 1.9-Bug#3990][Assigned] tests of rexml/rss reports many errors and failures without iconv — Usaku NAKAMURA <redmine@...>

Bug #3990: tests of rexml/rss reports many errors and failures without iconv

40 messages 2010/10/27
[#42500] [Ruby 1.9-Bug#3990][Closed] tests of rexml/rss reports many errors and failures without iconv — Kouhei Sutou <redmine@...> 2010/10/30

チケット #3990 が更新されました。 (by Kouhei Sutou)

[#42510] Re: [Ruby 1.9-Bug#3990][Closed] tests of rexml/rss reports many errors and failures without iconv — "NARUSE, Yui" <naruse@...> 2010/11/01

成瀬です。

[#42514] Re: [Ruby 1.9-Bug#3990][Closed] tests of rexml/rss reports many errors and failures without iconv — Kouhei Sutou <kou@...> 2010/11/02

須藤です。

[#42515] Re: [Ruby 1.9-Bug#3990][Closed] tests of rexml/rss reports many errors and failures without iconv — "NARUSE, Yui" <naruse@...> 2010/11/02

(2010/11/02 21:50), Kouhei Sutou wrote:

[#42516] Re: [Ruby 1.9-Bug#3990][Closed] tests of rexml/rss reports many errors and failures without iconv — Kouhei Sutou <kou@...> 2010/11/02

須藤です。

[#42517] Re: [Ruby 1.9-Bug#3990][Closed] tests of rexml/rss reports many errors and failures without iconv — "NARUSE, Yui" <naruse@...> 2010/11/02

成瀬です。

[#42518] Re: [Ruby 1.9-Bug#3990][Closed] tests of rexml/rss reports many errors and failures without iconv — Kouhei Sutou <kou@...> 2010/11/02

須藤です。

[#42519] Re: [Ruby 1.9-Bug#3990][Closed] tests of rexml/rss reports many errors and failures without iconv — "NARUSE, Yui" <naruse@...> 2010/11/03

成瀬です。

[#42543] Re: [Ruby 1.9-Bug#3990][Closed] tests of rexml/rss reports many errors and failures without iconv — Kouhei Sutou <kou@...> 2010/11/06

須藤です。

[#42548] Re: [Ruby 1.9-Bug#3990][Closed] tests of rexml/rss reports many errors and failures without iconv — "NARUSE, Yui" <naruse@...> 2010/11/07

(2010/11/06 12:10), Kouhei Sutou wrote:

[#42549] Re: [Ruby 1.9-Bug#3990][Closed] tests of rexml/rss reports many errors and failures without iconv — Kouhei Sutou <kou@...> 2010/11/07

須藤です。

[#42572] Re: [Ruby 1.9-Bug#3990][Closed] tests of rexml/rss reports many errors and failures without iconv — "NARUSE, Yui" <naruse@...> 2010/11/13

成瀬です。

[#42592] Re: [Ruby 1.9-Bug#3990][Closed] tests of rexml/rss reports many errors and failures without iconv — Kouhei Sutou <kou@...> 2010/11/18

須藤です。

[#42593] Re: [Ruby 1.9-Bug#3990][Closed] tests of rexml/rss reports many errors and failures without iconv — "NARUSE, Yui" <naruse@...> 2010/11/18

成瀬です。

[#42607] Re: [Ruby 1.9-Bug#3990][Closed] tests of rexml/rss reports many errors and failures without iconv — Kouhei Sutou <kou@...> 2010/11/20

須藤です。

[#42608] Re: [Ruby 1.9-Bug#3990][Closed] tests of rexml/rss reports many errors and failures without iconv — "NARUSE, Yui" <naruse@...> 2010/11/20

成瀬です。

[#42610] Re: [Ruby 1.9-Bug#3990][Closed] tests of rexml/rss reports many errors and failures without iconv — Kouhei Sutou <kou@...> 2010/11/20

須藤です。

[#42611] Re: [Ruby 1.9-Bug#3990][Closed] tests of rexml/rss reports many errors and failures without iconv — "NARUSE, Yui" <naruse@...> 2010/11/20

成瀬です。

[#42613] Re: [Ruby 1.9-Bug#3990][Closed] tests of rexml/rss reports many errors and failures without iconv — Kouhei Sutou <kou@...> 2010/11/21

須藤です。

[#42614] Re: [Ruby 1.9-Bug#3990][Closed] tests of rexml/rss reports many errors and failures without iconv — "NARUSE, Yui" <naruse@...> 2010/11/21

成瀬です。

[ruby-dev:42389] Call for Cooperation: CFUNC usage survey

From: SASADA Koichi <ko1@...>
Date: 2010-10-15 06:52:44 UTC
List: ruby-dev #42389
Hi,

I want to survey the Ruby interpreter usage.

If you have

  - a real application on Ruby 1.9 trunk
    if that application has a performance issue, it is welcome.
  - the build environment
  - time

please cooperate me to survey the CFUNC usage.

Procedure:
  (1) Check out ruby trunk
      $ svn co http://svn.ruby-lang.org/repos/trunk
  (2) Apply a patch which is attached to this mail
  (3) Build ruby interpter and  install it
  (4) Run application on the interpreter
      Ruby prints the results into STDERR at the end of ruby process.

      $ ruby [application] 2> result

  (5) Send me the result with
        - your environment (ruby -v)
        - brief description of your application.

      Download-able URL instead of attaching the result is preferable
      because the result will be a huge text file.

  (6) Do not forget to remove (or invalidate) installed Ruby


Result:
The results show the usage of CFUNC.  CFUNC is methods implemented in C.

	<format>
	method_name	[shallow count]	[deep count]
	...
	</format>

[shallow count] means the number of invoking the method named
[method_name] without invoking the other methods (and blocks, and so
on).  [deep count] is the number of invoking which invoke other methods.


result sample (sorted by Excel):
http://www.atdot.net/sp/view/fmjbal
application: rdoc (build process)
environment: ruby 1.9.3dev (2010-10-14) [i686-linux]


Purpose:

To tune the VM.  I can find out which CFUNC method / what kind of
methods should be faster.


Thank you for.

Regards,
Koichi

----
Japanese (にほんご):

 CFUNC がどんな感じで使われてるか知りたいので、パッチあてて実行して、結
果を送って下さると助かります。結果は、プロセス終了時に標準エラー出力に出
ます(正確には、スレッドが回収されるときにスレッド後のに出力)。

# 1.9 のリアルアプリケーションってどれくらいあるんだろ。

-- 
// SASADA Koichi at atdot dot net

Attachments (1)

cfuncsurvey.patch (4.37 KB, text/x-diff)
Index: vm_core.h
===================================================================
--- vm_core.h	(revision 29498)
+++ vm_core.h	(working copy)
@@ -479,6 +482,15 @@ typedef struct rb_thread_struct
     int abort_on_exception;
 #ifdef USE_SIGALTSTACK
     void *altstack;
+#endif
+
+#if CFUNC_FRAME_USAGE_CHECK
+    char *cfunc_usage_memo;
+    st_table *cfunc_usage_table;
+    struct cfunc_usage_record {
+	size_t shallow;
+	size_t deep;
+    };
 #endif
 } rb_thread_t;
 
Index: compile.c
===================================================================
--- compile.c	(revision 29498)
+++ compile.c	(working copy)
@@ -1800,6 +1800,7 @@ insn_set_specialized_instruction(rb_iseq
 static int
 iseq_specialized_instruction(rb_iseq_t *iseq, INSN *iobj)
 {
+    if (0) 
     if (iobj->insn_id == BIN(send)) {
 	ID mid = SYM2ID(OPERAND_AT(iobj, 0));
 	int argc = FIX2INT(OPERAND_AT(iobj, 1));
Index: vm.c
===================================================================
--- vm.c	(revision 29498)
+++ vm.c	(working copy)
@@ -8,6 +8,8 @@
 
 **********************************************************************/
 
+#define CFUNC_FRAME_USAGE_CHECK 1
+
 #include "ruby/ruby.h"
 #include "ruby/vm.h"
 #include "ruby/st.h"
@@ -1685,6 +1687,18 @@ rb_thread_mark(void *ptr)
     RUBY_MARK_LEAVE("thread");
 }
 
+static int
+cfunc_usage_print_i(st_data_t key, st_data_t val, st_data_t data)
+{
+    char *name = (char *)key;
+    struct cfunc_usage_record *record = (struct cfunc_usage_record *)val;
+
+    fprintf(stderr, "%s\t%" PRIdSIZE "\t%" PRIdSIZE "\n",
+	    name, record->shallow, record->deep);
+
+    return ST_CONTINUE;
+}
+
 static void
 thread_free(void *ptr)
 {
@@ -1708,6 +1722,14 @@ thread_free(void *ptr)
 	if (th->local_storage) {
 	    st_free_table(th->local_storage);
 	}
+
+#if CFUNC_FRAME_USAGE_CHECK
+	if (th->cfunc_usage_table) {
+	    fprintf(stderr, "CFUNC_FRAME_USAGE_CHECK: start\n");
+	    st_foreach(th->cfunc_usage_table, cfunc_usage_print_i, 0);
+	    fprintf(stderr, "CFUNC_FRAME_USAGE_CHECK: end\n");
+	}
+#endif
 
 #if USE_VALUE_CACHE
 	{
Index: vm_insnhelper.c
===================================================================
--- vm_insnhelper.c	(revision 29498)
+++ vm_insnhelper.c	(working copy)
@@ -68,6 +68,31 @@ vm_push_frame(rb_thread_t * th, const rb
     cfp->prof_time_chld = 0;
 #endif
 
+#if CFUNC_FRAME_USAGE_CHECK
+    if (th->cfunc_usage_memo) {
+	struct cfunc_usage_record *record;
+	int found = 0;
+
+	if (st_lookup(th->cfunc_usage_table, (st_data_t)th->cfunc_usage_memo, (st_data_t *)&record)) {
+	    found = 1;
+	}
+	else {
+	    record = malloc(sizeof(struct cfunc_usage_record));
+	    record->shallow = 0;
+	    record->deep = 0;
+	}
+
+	record->deep++;
+
+	st_insert(th->cfunc_usage_table, (st_data_t)th->cfunc_usage_memo, (st_data_t)record);
+
+	if (found) {
+	    free(th->cfunc_usage_memo);
+	}
+	th->cfunc_usage_memo = 0;
+    }
+#endif
+    
     if (VMDEBUG == 2) {
 	SDR();
     }
@@ -399,8 +424,50 @@ vm_call_cfunc(rb_thread_t *th, rb_contro
     cfp->me = me;
     reg_cfp->sp -= num + 1;
 
+#if CFUNC_FRAME_USAGE_CHECK
+    {
+	VALUE klassname = rb_mod_name(me->klass);
+	th->cfunc_usage_memo = malloc(0x20);
+	snprintf(th->cfunc_usage_memo, 0x20 - 1, "%s#%s",
+		 RTEST(klassname) ? RSTRING_PTR(klassname) : "??",
+		 rb_id2name(me->called_id));
+	th->cfunc_usage_memo[0x20-1] = 0;
+
+	if (!th->cfunc_usage_table) {
+	    th->cfunc_usage_table = st_init_strtable();
+	}
+    }
+#endif
+
     val = call_cfunc(def->body.cfunc.func, recv, (int)def->body.cfunc.argc, num, reg_cfp->sp + 1);
 
+#if CFUNC_FRAME_USAGE_CHECK
+    {
+	if (th->cfunc_usage_memo) {
+	    struct cfunc_usage_record *record;
+	    int found = 0;
+
+	    /* fprintf(stderr, "> %s\n", th->cfunc_usage_memo); */
+	    if (st_lookup(th->cfunc_usage_table, (st_data_t)th->cfunc_usage_memo, (st_data_t *)&record)) {
+		found = 1;
+	    }
+	    else {
+		record = malloc(sizeof(struct cfunc_usage_record));
+		record->shallow = 0;
+		record->deep = 0;
+	    }
+
+	    record->shallow++;
+
+	    st_insert(th->cfunc_usage_table, (st_data_t)th->cfunc_usage_memo, (st_data_t)record);
+
+	    if (found) {
+		free(th->cfunc_usage_memo);
+	    }
+	    th->cfunc_usage_memo = 0;
+	}
+    }
+#endif
     if (reg_cfp != th->cfp + 1) {
 	rb_bug("cfp consistency error - send");
     }

In This Thread

Prev Next