Class: Dtrace::Aggregate

Inherits:
Object
  • Object
show all
Defined in:
lib/dtrace/aggregate.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeAggregate

Create an empty Dtrace::Aggregate: use add_record to add data.



20
21
22
# File 'lib/dtrace/aggregate.rb', line 20

def initialize
  @tuple = Array.new
end

Instance Attribute Details

#tupleObject (readonly)

Returns the value of attribute tuple.



17
18
19
# File 'lib/dtrace/aggregate.rb', line 17

def tuple
  @tuple
end

#valueObject (readonly)

Returns the value of attribute value.



17
18
19
# File 'lib/dtrace/aggregate.rb', line 17

def value
  @value
end

Instance Method Details

#add_record(r) ⇒ Object

Add a Dtrace::AggData record to this aggregate. Returns nil until it receives a record of aggtype “last”, when it returns the complete Dtrace::Aggregate.



27
28
29
30
31
32
33
34
35
36
37
# File 'lib/dtrace/aggregate.rb', line 27

def add_record(r)
  case r.aggtype
  when "tuple"
    @tuple << r.value
  when "value"
    @value = r.value
  when "last"
    return self
  end
  nil
end