Class: StraceLog::Stat::CallCounter
- Inherits:
-
Object
- Object
- StraceLog::Stat::CallCounter
- Defined in:
- lib/strace_log.rb
Instance Attribute Summary collapse
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#rename ⇒ Object
readonly
Returns the value of attribute rename.
Instance Method Summary collapse
- #count(call) ⇒ Object
- #each ⇒ Object
-
#initialize(path) ⇒ CallCounter
constructor
A new instance of CallCounter.
- #rename_as(newpath) ⇒ Object
Constructor Details
#initialize(path) ⇒ CallCounter
Returns a new instance of CallCounter.
121 122 123 124 125 |
# File 'lib/strace_log.rb', line 121 def initialize(path) @path = path @rename = [] @counter = {} end |
Instance Attribute Details
#path ⇒ Object (readonly)
Returns the value of attribute path.
126 127 128 |
# File 'lib/strace_log.rb', line 126 def path @path end |
#rename ⇒ Object (readonly)
Returns the value of attribute rename.
126 127 128 |
# File 'lib/strace_log.rb', line 126 def rename @rename end |
Instance Method Details
#count(call) ⇒ Object
128 129 130 131 |
# File 'lib/strace_log.rb', line 128 def count(call) c = (@counter[call.func] ||= Counter.new) c.count(call) end |
#each ⇒ Object
138 139 140 141 142 |
# File 'lib/strace_log.rb', line 138 def each @counter.keys.map do |func| yield [@path,func,*@counter[func].to_a] end end |
#rename_as(newpath) ⇒ Object
133 134 135 136 |
# File 'lib/strace_log.rb', line 133 def rename_as(newpath) @rename << @path @path = newpath end |