Class: OsCtl::Lib::Zfs::ObjsetStats::Objset
- Inherits:
-
Object
- Object
- OsCtl::Lib::Zfs::ObjsetStats::Objset
- Defined in:
- lib/libosctl/zfs/objset_stats/objset.rb
Defined Under Namespace
Classes: AggregatedStats
Instance Attribute Summary collapse
-
#dataset_name ⇒ Object
Returns the value of attribute dataset_name.
-
#read_bytes ⇒ Object
Returns the value of attribute read_bytes.
-
#read_ios ⇒ Object
Returns the value of attribute read_ios.
-
#subdatasets ⇒ Object
readonly
Returns the value of attribute subdatasets.
-
#write_bytes ⇒ Object
Returns the value of attribute write_bytes.
-
#write_ios ⇒ Object
Returns the value of attribute write_ios.
Instance Method Summary collapse
- #aggregate_stats(into: nil) ⇒ Object
-
#initialize ⇒ Objset
constructor
A new instance of Objset.
Constructor Details
#initialize ⇒ Objset
Returns a new instance of Objset.
13 14 15 16 17 18 19 20 |
# File 'lib/libosctl/zfs/objset_stats/objset.rb', line 13 def initialize @write_ios = 0 @write_bytes = 0 @read_ios = 0 @read_bytes = 0 @subdatasets = [] @aggregated_stats = nil end |
Instance Attribute Details
#dataset_name ⇒ Object
Returns the value of attribute dataset_name.
10 11 12 |
# File 'lib/libosctl/zfs/objset_stats/objset.rb', line 10 def dataset_name @dataset_name end |
#read_bytes ⇒ Object
Returns the value of attribute read_bytes.
10 11 12 |
# File 'lib/libosctl/zfs/objset_stats/objset.rb', line 10 def read_bytes @read_bytes end |
#read_ios ⇒ Object
Returns the value of attribute read_ios.
10 11 12 |
# File 'lib/libosctl/zfs/objset_stats/objset.rb', line 10 def read_ios @read_ios end |
#subdatasets ⇒ Object (readonly)
Returns the value of attribute subdatasets.
11 12 13 |
# File 'lib/libosctl/zfs/objset_stats/objset.rb', line 11 def subdatasets @subdatasets end |
#write_bytes ⇒ Object
Returns the value of attribute write_bytes.
10 11 12 |
# File 'lib/libosctl/zfs/objset_stats/objset.rb', line 10 def write_bytes @write_bytes end |
#write_ios ⇒ Object
Returns the value of attribute write_ios.
10 11 12 |
# File 'lib/libosctl/zfs/objset_stats/objset.rb', line 10 def write_ios @write_ios end |
Instance Method Details
#aggregate_stats(into: nil) ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/libosctl/zfs/objset_stats/objset.rb', line 22 def aggregate_stats(into: nil) if @aggregated_stats return @aggregated_stats unless into into.write_ios += @aggregated_stats.write_ios into.write_bytes += @aggregated_stats.write_bytes into.read_ios += @aggregated_stats.read_ios into.read_bytes += @aggregated_stats.read_bytes end st = AggregatedStats.new(write_ios, write_bytes, read_ios, read_bytes) subdatasets.each do |subset| subset.aggregate_stats(into: st) end @aggregated_stats = st if into into.write_ios += st.write_ios into.write_bytes += st.write_bytes into.read_ios += st.read_ios into.read_bytes += st.read_bytes into else st end end |