Class: DTracer::Builder
- Inherits:
-
Object
- Object
- DTracer::Builder
- Defined in:
- lib/dtracer/builder.rb
Instance Method Summary collapse
- #add_begin_probe ⇒ Object
- #add_custom_probe ⇒ Object
- #add_options(is_quite, string_size = 102400) ⇒ Object
- #add_probe(probe_type) ⇒ Object
- #add_request_probe ⇒ Object
- #add_response_probe ⇒ Object
- #build ⇒ Object
-
#initialize ⇒ Builder
constructor
A new instance of Builder.
Constructor Details
#initialize ⇒ Builder
Returns a new instance of Builder.
3 4 5 |
# File 'lib/dtracer/builder.rb', line 3 def initialize @content = [] end |
Instance Method Details
#add_begin_probe ⇒ Object
13 14 15 16 17 18 |
# File 'lib/dtracer/builder.rb', line 13 def add_begin_probe @content << 'BEGIN {' @content << ' printf("Tracing started\n");' @content << '}' @content << '' end |
#add_custom_probe ⇒ Object
28 29 30 |
# File 'lib/dtracer/builder.rb', line 28 def add_custom_probe add_probe("custom") end |
#add_options(is_quite, string_size = 102400) ⇒ Object
7 8 9 10 11 |
# File 'lib/dtracer/builder.rb', line 7 def (is_quite, string_size = 102400) @content << "#pragma D option quiet" if is_quite @content << "#pragma D option strsize=#{string_size}" @content << '' end |
#add_probe(probe_type) ⇒ Object
36 37 38 39 40 41 |
# File 'lib/dtracer/builder.rb', line 36 def add_probe(probe_type) @content << "oadprobe*:::#{probe_type} {" @content << ' printf("%s\n\n", copyinstr(arg0));' @content << '}' @content << '' end |
#add_request_probe ⇒ Object
20 21 22 |
# File 'lib/dtracer/builder.rb', line 20 def add_request_probe add_probe("request") end |
#add_response_probe ⇒ Object
24 25 26 |
# File 'lib/dtracer/builder.rb', line 24 def add_response_probe add_probe("response") end |
#build ⇒ Object
32 33 34 |
# File 'lib/dtracer/builder.rb', line 32 def build @content.join("\n") end |