[#4745] Win32: Ruby & APR; build problems for Ruby Subversion SWIG bindings — Erik Huelsmann <ehuels@...>

Having taken upon me the task to provide a Windows build for

24 messages 2005/04/20
[#4746] Re: Win32: Ruby & APR; build problems for Ruby Subversion SWIG bindings — Austin Ziegler <halostatue@...> 2005/04/20

On 4/20/05, Erik Huelsmann <ehuels@gmail.com> wrote:

[#4747] Re: Win32: Ruby & APR; build problems for Ruby Subversion SWIG bindings — Erik Huelsmann <ehuels@...> 2005/04/20

Hi Austin,

[#4762] Re: Win32: Ruby & APR; build problems for Ruby Subversion SWIG bindings — nobu.nokada@... 2005/04/24

Hi,

[#4783] Re: Win32: Ruby & APR; build problems for Ruby Subversion SWIG bindings — Erik Huelsmann <ehuels@...> 2005/04/25

On 4/24/05, nobu.nokada@softhome.net <nobu.nokada@softhome.net> wrote:

[#4787] Re: Win32: Ruby & APR; build problems for Ruby Subversion SWIG bindings — nobu.nokada@... 2005/04/25

Hi,

[#4794] Re: Win32: Ruby & APR; build problems for Ruby Subversion SWIG bindings — Erik Huelsmann <ehuels@...> 2005/04/25

> > > Ruby is just using AC_TYPE_UID_T. So, using typedef for them,

[#4751] Illegal regexp causes segfault — Andrew Walrond <andrew@...>

irb(main):058:0> a = /\[([^]]*)\]/

13 messages 2005/04/22

Re: profiler.rb Schroedinbug

From: "H.Yamamoto" <ocean@...2.ccsnet.ne.jp>
Date: 2005-04-25 18:05:24 UTC
List: ruby-core #4793
Hello.

>This is AFAIk caused by rubygems which sets the RUBYOPT environment 
>variable so that it will always invoke -rubygems before anything else. I 
>think that debug, profiler, tracer and other libraries will then get 
>return events from the trace func for which there was no call event 
>which confuses them.

Like this? Seems to solve both rubygems issue and [ruby-core:4782].

data[0] : how many times returned
data[4] : how many times called

# Sorry for [ruby-core:4782] patch. That didn't make any sense.

Index: profiler.rb
===================================================================
RCS file: /src/ruby/lib/profiler.rb,v
retrieving revision 1.1
diff -u -w -b -p -r1.1 profiler.rb
--- profiler.rb	20 Dec 2002 09:00:10 -0000	1.1
+++ profiler.rb	25 Apr 2005 17:58:24 -0000
@@ -6,10 +6,25 @@ module Profiler__
     case event
     when "call", "c-call"
       now = Float(Times::times[0])
-      @@stack.push [now, 0.0, id]
+      name = get_name(klass, id)
+      data = (@@map[name] ||= [0, 0.0, 0.0, name, 0])
+      data[4] += 1
+      @@stack.push [now, 0.0]
     when "return", "c-return"
       now = Float(Times::times[0])
+      name = get_name(klass, id)
+      if (data = @@map[name]) && (data[0] < data[4])
       tick = @@stack.pop
+        data[0] += 1
+        cost = now - tick[0]
+        data[1] += cost
+        data[2] += cost - tick[1]
+        @@stack[-1][1] += cost
+      end
+    end
+  }
+module_function
+  def get_name(klass, id)
       name = klass.to_s
       if name.nil? then name = '' end
       if klass.kind_of? Class
@@ -18,23 +33,12 @@ module Profiler__
 	name += "."
       end
       name += id.id2name
-      data = @@map[name]
-      unless data
-	data = [0.0, 0.0, 0.0, name]
-	@@map[name] = data
       end
-      data[0] += 1
-      cost = now - tick[0]
-      data[1] += cost
-      data[2] += cost - tick[1]
-      @@stack[-1][1] += cost
-    end
-  }
-module_function
+  private :get_name
   def start_profile
     @@start = Float(Times::times[0])
-    @@stack = [[0, 0, :toplevel], [0, 0, :dummy]]
-    @@map = {"#toplevel" => [1, 0, 0, "#toplevel"]}
+    @@stack = [[0.0, 0.0]]
+    @@map = {"#toplevel" => [1, 0.0, 0.0, "#toplevel", 1]}
     set_trace_func PROFILE_PROC
   end
   def stop_profile
@@ -46,6 +50,7 @@ module_function
     if total == 0 then total = 0.01 end
     @@map["#toplevel"][1] = total
     data = @@map.values
+    data.delete_if{|a| a[0] != a[4]}
     data.sort!{|a,b| b[2] <=> a[2]}
     sum = 0
     f.printf "  %%   cumulative   self              self     total\n"           


In This Thread

Prev Next