Merge pull request #354 from robertbaldyga/multistream-seq-cutoff
Introduce multi-stream seqential cutoff
This commit is contained in:
@@ -287,6 +287,18 @@ class Cache:
|
||||
if status:
|
||||
raise OcfError("Error setting cache seq cut off policy", status)
|
||||
|
||||
def set_seq_cut_off_threshold(self, threshold: int):
|
||||
self.write_lock()
|
||||
|
||||
status = self.owner.lib.ocf_mngt_core_set_seq_cutoff_threshold_all(
|
||||
self.cache_handle, threshold
|
||||
)
|
||||
|
||||
self.write_unlock()
|
||||
|
||||
if status:
|
||||
raise OcfError("Error setting cache seq cut off policy", status)
|
||||
|
||||
def configure_device(
|
||||
self, device, force=False, perform_test=True, cache_line_size=None
|
||||
):
|
||||
@@ -574,6 +586,8 @@ lib.ocf_mngt_cache_cleaning_set_policy.argtypes = [c_void_p, c_uint32]
|
||||
lib.ocf_mngt_cache_cleaning_set_policy.restype = c_int
|
||||
lib.ocf_mngt_core_set_seq_cutoff_policy_all.argtypes = [c_void_p, c_uint32]
|
||||
lib.ocf_mngt_core_set_seq_cutoff_policy_all.restype = c_int
|
||||
lib.ocf_mngt_core_set_seq_cutoff_threshold_all.argtypes = [c_void_p, c_uint32]
|
||||
lib.ocf_mngt_core_set_seq_cutoff_threshold_all.restype = c_int
|
||||
lib.ocf_stats_collect_cache.argtypes = [
|
||||
c_void_p,
|
||||
c_void_p,
|
||||
|
||||
@@ -72,7 +72,7 @@ class OcfCompletion:
|
||||
except KeyError:
|
||||
raise KeyError(f"No completion argument {key} specified")
|
||||
|
||||
def __init__(self, completion_args: list):
|
||||
def __init__(self, completion_args: list, context=None):
|
||||
"""
|
||||
Provide ctypes arg list, and optionally index of status argument in
|
||||
completion function which will be extracted (default - last argument).
|
||||
@@ -83,6 +83,7 @@ class OcfCompletion:
|
||||
self.e = Event()
|
||||
self.results = OcfCompletion.CompletionResult(completion_args)
|
||||
self._as_parameter_ = self.callback
|
||||
self.context = context
|
||||
|
||||
@property
|
||||
def callback(self):
|
||||
|
||||
@@ -148,6 +148,61 @@ class Size:
|
||||
else:
|
||||
return "{} TiB".format(self.TiB)
|
||||
|
||||
def __repr__(self):
|
||||
return f"Size({self.bytes})"
|
||||
|
||||
def __eq__(self, other):
|
||||
return self.bytes == other.bytes
|
||||
|
||||
def __add__(self, other):
|
||||
return Size(self.bytes + other.bytes)
|
||||
|
||||
def __sub__(self, other):
|
||||
return Size(self.bytes - other.bytes)
|
||||
|
||||
def __mul__(self, other):
|
||||
return Size(self.bytes * int(other))
|
||||
|
||||
def __truediv__(self, other):
|
||||
return Size(self.bytes / int(other))
|
||||
|
||||
def __floordiv__(self, other):
|
||||
return Size(self.bytes // int(other))
|
||||
|
||||
def __rmul__(self, other):
|
||||
return Size(self.bytes * int(other))
|
||||
|
||||
def __rtruediv__(self, other):
|
||||
return Size(int(other) / self.bytes)
|
||||
|
||||
def __rfloordiv__(self, other):
|
||||
return Size(int(other) // self.bytes)
|
||||
|
||||
def __iadd__(self, other):
|
||||
self.bytes += other.bytes
|
||||
|
||||
return self
|
||||
|
||||
def __isub__(self, other):
|
||||
self.bytes -= other.bytes
|
||||
|
||||
return self
|
||||
|
||||
def __imul__(self, other):
|
||||
self.bytes *= int(other)
|
||||
|
||||
return self
|
||||
|
||||
def __itruediv__(self, other):
|
||||
self.bytes /= int(other)
|
||||
|
||||
return self
|
||||
|
||||
def __ifloordir__(self, other):
|
||||
self.bytes //= int(other)
|
||||
|
||||
return self
|
||||
|
||||
|
||||
def print_structure(struct, indent=0):
|
||||
print(struct)
|
||||
|
||||
Reference in New Issue
Block a user