test api: implement UsageStats
arithmetic ops
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
This commit is contained in:
parent
91f0cbf6aa
commit
863947ddb8
@ -387,6 +387,9 @@ class UsageStats:
|
||||
f"Dirty: {self.dirty}\n"
|
||||
)
|
||||
|
||||
def __repr__(self):
|
||||
return str(self)
|
||||
|
||||
def __eq__(self, other):
|
||||
if not other:
|
||||
return False
|
||||
@ -397,6 +400,24 @@ class UsageStats:
|
||||
and self.dirty == other.dirty
|
||||
)
|
||||
|
||||
def __ne__(self, other):
|
||||
return not self == other
|
||||
|
||||
def __add__(self, other):
|
||||
return UsageStats(
|
||||
self.occupancy + other.occupancy,
|
||||
self.free + other.free,
|
||||
self.clean + other.clean,
|
||||
self.dirty + other.dirty
|
||||
)
|
||||
|
||||
def __iadd__(self, other):
|
||||
self.occupancy += other.occupancy
|
||||
self.free += other.free
|
||||
self.clean += other.clean
|
||||
self.dirty += other.dirty
|
||||
return self
|
||||
|
||||
|
||||
class InactiveUsageStats:
|
||||
def __init__(self, inactive_occupancy, inactive_clean, inactive_dirty):
|
||||
|
Loading…
Reference in New Issue
Block a user