Class: Omnizip::ETA::SampleHistory::Sample
- Inherits:
-
Struct
- Object
- Struct
- Omnizip::ETA::SampleHistory::Sample
- Defined in:
- lib/omnizip/eta/sample_history.rb
Overview
Single sample data point
Instance Attribute Summary collapse
-
#bytes_processed ⇒ Object
Returns the value of attribute bytes_processed.
-
#files_processed ⇒ Object
Returns the value of attribute files_processed.
-
#timestamp ⇒ Object
Returns the value of attribute timestamp.
Instance Method Summary collapse
-
#rate_since(other) ⇒ Float
Calculate bytes/second rate between two samples.
Instance Attribute Details
#bytes_processed ⇒ Object
Returns the value of attribute bytes_processed
16 17 18 |
# File 'lib/omnizip/eta/sample_history.rb', line 16 def bytes_processed @bytes_processed end |
#files_processed ⇒ Object
Returns the value of attribute files_processed
16 17 18 |
# File 'lib/omnizip/eta/sample_history.rb', line 16 def files_processed @files_processed end |
#timestamp ⇒ Object
Returns the value of attribute timestamp
16 17 18 |
# File 'lib/omnizip/eta/sample_history.rb', line 16 def @timestamp end |
Instance Method Details
#rate_since(other) ⇒ Float
Calculate bytes/second rate between two samples
21 22 23 24 25 26 27 |
# File 'lib/omnizip/eta/sample_history.rb', line 21 def rate_since(other) time_diff = - other. return 0.0 if time_diff <= 0 bytes_diff = bytes_processed - other.bytes_processed bytes_diff / time_diff end |