jruby/jruby — pull request #2081 by dmarcotte (2014-11-03 16:34:44+00:00)
Title: Fix profile output

86a75dce incorrectly updated the method names the profiler needs to ignore, resulting in incorrect output.

This _is_ covered by tests in `spec/profiler/graph_profile_printer_spec.rb`, but I guess that spec doesn't run on Travis because it needs `--profile`?

Here's a manual demonstration of the issue:

```ruby
require 'jruby/profiler'

profile_data = JRuby::Profiler.profile do
sleep(1)
end

profile_printer = JRuby::Profiler::GraphProfilePrinter.new(profile_data)
profile_printer.printProfile(STDOUT)
```

Output of this script without this patch:
```
Profiling enabled; ^C shutdown will now dump profile info

Total time: 0.00

%total %self total self children calls name
---------------------------------------------------------------------------------------------------------
1.00 0.00 1.00 1/1 JRuby::Profiler.profile
100% 100% 1.00 0.00 1.00 1 JRuby::Profiler.profiled_code
1.00 1.00 0.00 1/1 Kernel.sleep
---------------------------------------------------------------------------------------------------------
1.00 1.00 0.00 1/1 JRuby::Profiler.profiled_code
100% 100% 1.00 1.00 0.00 1 Kernel.sleep
0.00 0.00 0.00 1/1 Fixnum#to_f
---------------------------------------------------------------------------------------------------------
0.02 0.01 0.00 1/1 JRuby::Profiler.profile
100% 100% 0.02 0.01 0.00 1 JRuby::Profiler.start
0.00 0.00 0.00 1/1 JRuby::Profiler.clear
<--- SNIP! --->
```

(Notice the total time of `0.00`, and all the `100%`s, and of course the extraneous `JRuby::Profiler` lines)

Output of this script with this patch:

```
Profiling enabled; ^C shutdown will now dump profile info

Total time: 1.00

%total %self total self children calls name
---------------------------------------------------------------------------------------------------------
1.00 1.00 0.00 1/1 (top)
100% 99% 1.00 1.00 0.00 1 Kernel.sleep
0.00 0.00 0.00 1/1 Fixnum#to_f
---------------------------------------------------------------------------------------------------------
100% 0% 1.00 0.00 1.00 1 (top)
1.00 1.00 0.00 1/1 Kernel.sleep
---------------------------------------------------------------------------------------------------------
0.00 0.00 0.00 1/1 Kernel.sleep
0% 0% 0.00 0.00 0.00 1 Fixnum#to_f
```