Ruby-prof on Ruby 1.9 woes

I’m trying to use ruby-prof with Ruby 1.9.1p243 on 64-bit Ubuntu.

The current released version doesn’t work, but a gem built from the
ruby-prof’s svn repo’s trunk at least installs properly. Unfortunately,
when trying to profile a Ruby 1.9 it breaks as described at
http://redmine.ruby-lang.org/issues/show/1227

I tried to clone http://github.com/trafficbroker/ruby-prof and
‘rake gem’, but a subsequent ‘gem install’ attempt results in

Building native extensions. This could take a while...
ERROR: Error installing ruby-prof-0.7.3.2.gem:
  ERROR: Failed to build gem native extension.

/home/shot/opt/ruby-1.9.1-p243/bin/ruby extconf.rb install ruby-prof-0.7.3.2.gem
checking for sys/times.h... yes
checking for rb_os_allocated_objects()... no
checking for rb_gc_allocated_size()... no
checking for rb_gc_collections()... no
checking for rb_gc_time()... no
checking for rb_heap_total_mem()... no
checking for rb_gc_heap_info()... no
checking for rb_gc_malloc_allocations()... no
checking for rb_gc_malloc_allocated_size()... no
creating Makefile

make
gcc -I. -I/home/shot/opt/ruby-1.9.1-p243/include/ruby-1.9.1/x86_64-linux -I/home/shot/opt/ruby-1.9.1-p243/include/ruby-1.9.1/ruby/backward -I/home/shot/opt/ruby-1.9.1-p243/include/ruby-1.9.1 -I. -DHAVE_SYS_TIMES_H -fPIC -O2 -g -Wall -Wno-parentheses -o ruby_prof.o -c ruby_prof.c
ruby_prof.c:890: error: expected declaration specifiers or ‘...’ before ‘NODE’
ruby_prof.c: In function ‘prof_event_hook’:
ruby_prof.c:1137: error: ‘node’ undeclared (first use in this function)
ruby_prof.c:1137: error: (Each undeclared identifier is reported only once
ruby_prof.c:1137: error: for each function it appears in.)
ruby_prof.c:1137: error: too many arguments to function ‘get_method’
ruby_prof.c:1143: warning: passing argument 5 of ‘get_method’ makes pointer from integer without a cast
ruby_prof.c:1143: error: too many arguments to function ‘get_method’
make: *** [ruby_prof.o] Error 1

I finally tried to use upstream ruby-prof 0.7.3 patched just with the
patch from http://redmine.ruby-lang.org/issues/show/1227#note-6 but this
makes the profiling run for ages in most of my cases. I even tested this
in a freshly-setup 32-bit Ubuntu, but with the same results. :expressionless:

Does anyone know of a way to make ruby-prof
work in sensible time in my case?

Steps to reproduce:

1. Install any ruby-prof version that’s supposed to work with Ruby 1.9
2. git clone git://github.com/Chastell/art-decomp.git
3. cd art-decomp
4. export RUBYOPT="$RUBYOPT -Ku' # -Ku doesn’t work in shebang on Linux

$ time bin/inputs kiss/s510

real 0m0.571s
user 0m0.468s
sys 0m0.008s

$ time bin/inputs kiss/s420

real 0m1.183s
user 0m1.040s
sys 0m0.012s

$ time ruby-prof bin/inputs kiss/s510

real 0m2.862s
user 0m2.100s
sys 0m0.556s

$ time ruby-prof bin/inputs kiss/s420

[take ages, but does finish eventually]

— Shot

···

--
Triskadekaphobiacs are presumably upset that, although 13.untrust appears to
succeed and reinforce their beliefs, the state doesn’t stick; 13.untrusted?
subsequently returns false. Similarly, logicians and cynics alike
must, respectively, rejoice and despair that true.untrust.untrusted?
is perpetually false. [Run Paint Run Run, ruby-core]

The current released version doesn’t work, but a gem built from the
ruby-prof’s svn repo’s trunk at least installs properly. Unfortunately,
when trying to profile a Ruby 1.9 it breaks as described at
http://redmine.ruby-lang.org/issues/show/1227

The patches there don't fix it?
-r

Roger Pack:

The current released version doesn’t work, but a gem built from the
ruby-prof’s svn repo’s trunk at least installs properly. Unfortunately,
when trying to profile a Ruby 1.9 it breaks as described at
http://redmine.ruby-lang.org/issues/show/1227

The patches there don't fix it?

The patch there fixes the trunk version of ruby-prof in that it does
work under Ruby 1.9, but ruby-prof runs for ages in most cases (cases
which seem quite similar to ones where it behaves – and I never had this
kind of problems with ruby-prof under Ruby 1.8). Basically, while it
makes the whole program run a bit slower (which is understandable), the
compilation of the final report takes ridiculously long.

I’ll see whether backporting my code to Ruby 1.8 is a viable option and
if so whether profiling it then makes a difference with regards to run
times.

— Shot

···

--
Heaven won’t have me and Hell’s afraid I’ll take over.

Basically, while it
makes the whole program run a bit slower (which is understandable), the
compilation of the final report takes ridiculously long.

gem install jeremy-ruby-prof

might help?
-r

···

--
Posted via http://www.ruby-forum.com/\.

Thanks, Roger, for all your prompt and to-the-point help! :slight_smile:

Roger Pack:

Basically, while it makes the whole program run a bit slower (which
is understandable), the compilation of the final report takes
ridiculously long.

gem install jeremy-ruby-prof
might help?

Perfect, thank you!

(I do like the ease-of-forking granted by Git/GitHub, but
choosing *which* ruby-prof fork there has the right combination
of working-under-Ruby-1.9 and performance was too much for me,
apparently.)

Now off to figure why does this version produces a 48 MiB HTML
profile (with tons of distinct references like Set#&-2388) while the
slow-as-melasses one produces a 1.4 MiB HTML profile (with all the Set#&
calls combined into Set#& and Set#&-1)…

— Shot

···

--
For some reason, this signature reminds everyone of Marvin Zelkowitz.