Class: DtraceStackRecord
- Inherits:
-
Object
- Object
- DtraceStackRecord
- Defined in:
- lib/dtracestackrecord.rb
Overview
A record representing the result of a stack() or ustack() action. Its value is a list of symbolic stack frames:
#<DtraceStackRecord:0x14e24 @value=
["libSystem.B.dylib`__sysctl+0xa",
"libdtrace.dylib`dt_aggregate_go+0x9a",
"dtrace_api.bundle`dtrace_hdl_go+0x30",
"libruby.1.dylib`rb_eval_string_wrap+0x40fd",
"libruby.1.dylib`rb_eval_string_wrap+0x4cdb",
...
"libruby.1.dylib`rb_apply+0x392",
"libruby.1.dylib`rb_eval_string_wrap+0xe82"]>
Instance Attribute Summary collapse
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
-
#parse(raw) ⇒ Object
Given a stack as a string returned from DTrace, set the value of this record to a list of stack frames.
Instance Attribute Details
#value ⇒ Object (readonly)
Returns the value of attribute value.
20 21 22 |
# File 'lib/dtracestackrecord.rb', line 20 def value @value end |
Instance Method Details
#parse(raw) ⇒ Object
Given a stack as a string returned from DTrace, set the value of this record to a list of stack frames.
24 25 26 27 |
# File 'lib/dtracestackrecord.rb', line 24 def parse(raw) frames = raw.split(/\n/) @value = frames.map {|f| f.lstrip }.select {|f| f.length > 0 } end |