Bug 1362437 - Compile Ruby with SystemTap
Summary: Compile Ruby with SystemTap
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat Software Collections
Classification: Red Hat
Component: rh-ruby22
Version: unspecified
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: alpha
: 2.2
Assignee: Pavel Valena
QA Contact: BaseOS QE - Apps
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-08-02 08:04 UTC by Lukas Zapletal
Modified: 2016-09-06 13:37 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-09-05 12:20:29 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Lukas Zapletal 2016-08-02 08:04:24 UTC
For Satellite performance debugging, we would like to have the possibility to hook on ruby markers, but it's not possible:

[root@fseven ~]# cat rubystack.stp 
#!/usr/bin/stap·

global fn_calls;

probe ruby.cmethod.entry
{
        fn_calls[classname, methodname] <<< 1;
}

probe end {
        foreach ([classname, methodname] in fn_calls- limit 30) {
                printf("%dx %s.%s\n",
                                @count(fn_calls[classname, methodname]),
                                classname, methodname);
        }

        delete fn_calls;
}

# SCL RUBY

[root@fseven ~]# stap rubystack.stp -c "scl enable rh-ruby22 \"ruby factorial.rb 5\""
120

# SYSTEM RUBY (working ok)

[root@fseven ~]# stap rubystack.stp -c "ruby factorial.rb 5"
120
2823x Module.===
1728x BasicObject.==
1728x Kernel.===
997x Symbol.to_s
980x Kernel.initialize_dup
979x Kernel.dup
960x Kernel.instance_variable_set
683x Hash.[]=
676x String.to_s
499x String.initialize_copy
445x Class.new
386x String.gsub
384x Array.initialize_copy
327x Kernel.class
320x Module.method_added
315x Array.each
286x Array.flatten
260x File.file?
242x #<Class:0x0000000213ad88>.core#define_method
236x String.<=>
220x String.to_i
204x Enumerable.any?
179x String.strip
179x File.join
177x Regexp.=~
164x Kernel.respond_to?
164x Kernel.untaint
156x String.=~
149x Array.last
146x Array.map!

Thanks!

Comment 1 Pavel Valena 2016-08-11 12:25:32 UTC
I will look into it.

Comment 2 Pavel Valena 2016-08-26 17:29:40 UTC
Hi,

I took your exact .stp file and I got correct SystemTap output without any issue.

In your case it is caused by invalid commands order. Running `scl enable ...` command, shell environment and paths are changed, which interferes with SystemTap.

# rpm -q rh-ruby22-ruby
rh-ruby22-ruby-2.2.2-15.el7.x86_64

# scl enable rh-ruby22 -- stap rubystack.stp -c "ruby factorial.rb 5"
5 => 120
377x Module.method_added
317x String.gsub
269x #<Class:0x00000001df3170>.core#define_method
228x Kernel.initialize_dup
228x String.initialize_copy
228x Kernel.dup
164x BasicObject.singleton_method_added
139x #<Class:0x00000001df3170>.core#define_singleton_method
93x String.[]
92x Module.===
84x Kernel.===
74x BasicObject.==
71x String.<=>
69x String.replace
61x Class.inherited
41x IO.set_encoding
33x Module.attr_reader
30x Symbol.to_s
26x Kernel.require
23x Module.attr_accessor
20x Kernel.nil?
20x BasicObject.!=
18x String.=~
17x Module.private
17x Kernel.!~
16x Module.autoload
16x #<Class:0x00000001df3170>.core#set_method_alias
14x Class.new
13x Array.==
10x File.join

[rh-ruby22 ~]# ruby --version
ruby 2.2.2p95 (2015-04-13 revision 50295) [x86_64-linux]

Please confirm that it works with commands in correct order.

Comment 3 Vít Ondruch 2016-09-05 12:20:29 UTC
I agree with Pavel's assessment => Closing this as a NOTABUG. Feel free to reopen in case we are wrong.

Comment 4 Lukas Zapletal 2016-09-06 13:37:44 UTC
Thanks Pavel, I haven't noticed this.


Note You need to log in before you can comment on or make changes to this bug.