def __init__(self, device_name: str, raw_stats: list = None): metrics_number = 13 if raw_stats is None: raw_stats = [0] * metrics_number if len(raw_stats) < metrics_number: raw_stats.extend([0] * metrics_number) self.device_name = device_name # rrqm/s self.read_requests_merged_per_sec = float(raw_stats[0]) # wrqm/s self.write_requests_merged_per_sec = float(raw_stats[1]) # r/s self.read_requests_per_sec = float(raw_stats[2]) # w/s self.write_requests_per_sec = float(raw_stats[3]) # rkB/s self.reads_per_sec = Size(float(raw_stats[4]), UnitPerSecond(Unit.KiloByte)) # wkB/s self.writes_per_sec = Size(float(raw_stats[5]), UnitPerSecond(Unit.KiloByte)) # avgrq-sz self.average_request_size = float(raw_stats[6]) # `in sectors` # avgqu-sz self.average_queue_length = float(raw_stats[7]) # await self.average_service_time = Time(milliseconds=float(raw_stats[8])) # r_await self.read_average_service_time = Time(milliseconds=float(raw_stats[9])) # w_await self.write_average_service_time = Time(milliseconds=float(raw_stats[10])) # iostat's documentation says to not trust 11th field # util self.utilization = float(raw_stats[12])
def __init__(self, device_name: str, raw_stats: list = None): metrics_number = 5 if raw_stats is None: raw_stats = [0] * metrics_number if len(raw_stats) < metrics_number: raw_stats.extend([0] * metrics_number) self.device_name = device_name # tps self.transfers_per_second = float(raw_stats[0]) # kB_read/s self.reads_per_second = Size(float(raw_stats[1]), UnitPerSecond(Unit.KiloByte)) # kB_wrtn/s self.writes_per_second = Size(float(raw_stats[2]), UnitPerSecond(Unit.KiloByte)) # kB_read self.total_reads = Size(float(raw_stats[3]), Unit.KibiByte) # kB_wrtn self.total_writes = Size(float(raw_stats[4]), Unit.KibiByte)
def __init__(self, trace): try: self.iops = float(trace["throughput"]["value"]) self.workset = Size(float(trace["workset"]["value"]), Unit.Blocks512) bandwidth_unit = parse_unit( trace["bandwidth"]["unit"].split("/")[0]) bandwidth_value = float(trace["bandwidth"]["value"]) self.bandwidth = Size(bandwidth_value, UnitPerSecond(bandwidth_unit)) except KeyError: self.iops = 0 self.workset = Size(0) self.bandwidth = Size(0) if "write invalidation factor" in trace: self.wif = float(trace["write invalidation factor"]["value"]) else: self.wif = None
def read_bandwidth_deviation(self): return Size(self.job.read.bw_dev, UnitPerSecond(Unit.KibiByte))
def read_bandwidth_average(self): return Size(self.job.read.bw_mean, UnitPerSecond(Unit.KibiByte))
def read_bandwidth(self): return Size(self.job.read.bw, UnitPerSecond(Unit.KibiByte))
def trim_bandwidth_deviation(self): return Size(self.job.trim.bw_dev, UnitPerSecond(Unit.KibiByte))
def trim_bandwidth_average(self): return Size(self.job.trim.bw_mean, UnitPerSecond(Unit.KibiByte))
def trim_bandwidth(self): return Size(self.job.trim.bw, UnitPerSecond(Unit.KibiByte))
def write_bandwidth_deviation(self): return Size(self.job.write.bw_dev, UnitPerSecond(Unit.KibiByte))
def write_bandwidth_average(self): return Size(self.job.write.bw_mean, UnitPerSecond(Unit.KibiByte))
def write_bandwidth(self): return Size(self.job.write.bw, UnitPerSecond(Unit.KibiByte))