def run(self): # Wait for the filesystem that is being monitored to exist. while not ZfsApi.fs_exists(self.filesystem): time.sleep(1) while True: time.sleep(1) self.size_ma.insert_value(ZfsApi.get_filesystem_size(self.filesystem)) result_string = "" for size_delta,diff in self.size_ma.get_diffs(): size_diff_in_bytes = float(diff)/size_delta size_diff_in_mib = Common.bytes_to_mebibyte(size_diff_in_bytes) reasonable_string = '%.3f' % size_diff_in_mib result_string = result_string + reasonable_string.rjust(9) print("Average speed in mib/sec") print(result_string)
def print_stats_to_file(self): """Since the stats collected at the begingng and end of a run are the same, they can be collapsed into a single function""" current_time = time.time() self.log("time: " + str(current_time)) current_txg = ZfsApi.get_current_txg(Configs.main_pool) self.log("TXG: " + str(current_txg)) # If the filesystem does not exist, its size is 0. if ZfsApi.fs_exists(self.filesystem): current_size = ZfsApi.get_filesystem_size(self.filesystem) self.log("size: " + str(current_size)) else: self.log("size: 0") self.log("zpool iostat -v:") self.log(subprocess.check_output(["zpool", "iostat", "-v"])) self.log("zpool status:") self.log(subprocess.check_output(["zpool", "status"]))
def print_stats_to_file(self): """Since the stats collected at the begingng and end of a run are the same, they can be collapsed into a single function""" current_time = time.time() self.log("time: " + str(current_time)) current_txg = ZfsApi.get_current_txg(Configs.main_pool) self.log("TXG: " + str(current_txg)) # If the filesystem does not exist, its size is 0. if ZfsApi.fs_exists(self.filesystem): current_size = ZfsApi.get_filesystem_size(self.filesystem) self.log("size: " + str(current_size)) else: self.log("size: 0") self.log("zpool iostat -v:") self.log(subprocess.check_output(['zpool', 'iostat', '-v'])) self.log("zpool status:") self.log(subprocess.check_output(['zpool', 'status']))