def on_benchmark_stop(self): if self.process is not None: # Be aware the semantics of write counts etc. are different for disk and process statistics. # Thus we're conservative and only report I/O bytes now. # noinspection PyBroadException try: # we have process-based disk counters, no need to worry how many nodes are on this host if self.process_start: process_end = sysstats.process_io_counters(self.process) read_bytes = process_end.read_bytes - self.process_start.read_bytes write_bytes = process_end.write_bytes - self.process_start.write_bytes elif self.disk_start: if self.node_count_on_host > 1: logger.info("There are [%d] nodes on this host and Rally fell back to disk I/O counters. " "Attributing [1/%d] of total I/O to [%s]." % (self.node_count_on_host, self.node_count_on_host, self.node.node_name)) disk_end = sysstats.disk_io_counters() read_bytes = (disk_end.read_bytes - self.disk_start.read_bytes) // self.node_count_on_host write_bytes = (disk_end.write_bytes - self.disk_start.write_bytes) // self.node_count_on_host else: raise RuntimeError("Neither process nor disk I/O counters are available") self.metrics_store.put_count_node_level(self.node.node_name, "disk_io_write_bytes", write_bytes, "byte") self.metrics_store.put_count_node_level(self.node.node_name, "disk_io_read_bytes", read_bytes, "byte") # Catching RuntimeException is not sufficient as psutil might raise AccessDenied et.al. which is derived from Exception except BaseException: logger.exception("Could not determine I/O stats at benchmark end.")
def on_benchmark_start(self): if self.process is not None: self.disk_start = sysstats.disk_io_counters() self.process_start = sysstats.process_io_counters(self.process) if self.process_start: logger.info("Using more accurate process-based I/O counters.") else: logger.warn("Process I/O counters are unsupported on this platform. Falling back to less accurate disk I/O counters.")
def on_benchmark_start(self): if self.process is not None: self.disk_start = sysstats.disk_io_counters() self.process_start = sysstats.process_io_counters(self.process) if self.process_start: logger.info("Using more accurate process-based I/O counters.") else: logger.warn( "Process I/O counters are unsupported on this platform. Falling back to less accurate disk I/O counters." )
def on_benchmark_stop(self): if self.process is not None: # Be aware the semantics of write counts etc. are different for disk and process statistics. # Thus we're conservative and only report I/O bytes now. disk_end = sysstats.disk_io_counters() process_end = sysstats.process_io_counters(self.process) self.metrics_store.put_count_node_level(self.node.node_name, "disk_io_write_bytes", self.write_bytes(process_end, disk_end), "byte") self.metrics_store.put_count_node_level(self.node.node_name, "disk_io_read_bytes", self.read_bytes(process_end, disk_end), "byte")
def run(self): self.disk_start = sysstats.disk_io_counters(self.disk_name) self.process_start = sysstats.process_io_counters(self.process) if self.process_start: logger.info("Using more accurate process-based I/O counters.") else: logger.warn("Process I/O counters are unsupported on this platform. Falling back to less accurate disk I/O counters.") while not self.stop: self.metrics_store.put_value_node_level(self.node.node_name, "cpu_utilization_1s_%s" % self.phase.name, sysstats.cpu_utilization(self.process), "%")
def on_benchmark_start(self): if self.process is not None: self.process_start = sysstats.process_io_counters(self.process) if self.process_start: logger.info("Using more accurate process-based I/O counters.") else: try: self.disk_start = sysstats.disk_io_counters() logger.warning("Process I/O counters are unsupported on this platform. Falling back to less accurate disk I/O counters.") except RuntimeError: logger.exception("Could not determine I/O stats at benchmark start.")
def finish(self): self.stop = True self.join() # Be aware the semantics of write counts etc. are different for disk and process statistics. # Thus we're conservative and only report I/O bytes now. disk_end = sysstats.disk_io_counters(self.disk_name) process_end = sysstats.process_io_counters(self.process) self.metrics_store.put_count_node_level(self.node.node_name, "disk_io_write_bytes_%s" % self.phase.name, self.write_bytes(process_end, disk_end), "byte") self.metrics_store.put_count_node_level(self.node.node_name, "disk_io_read_bytes_%s" % self.phase.name, self.read_bytes(process_end, disk_end), "byte")
def on_benchmark_stop(self): if self.process is not None: # Be aware the semantics of write counts etc. are different for disk and process statistics. # Thus we're conservative and only report I/O bytes now. disk_end = sysstats.disk_io_counters() process_end = sysstats.process_io_counters(self.process) self.metrics_store.put_count_node_level( self.node.node_name, "disk_io_write_bytes", self.write_bytes(process_end, disk_end), "byte") self.metrics_store.put_count_node_level( self.node.node_name, "disk_io_read_bytes", self.read_bytes(process_end, disk_end), "byte")
def run(self): self.disk_start = sysstats.disk_io_counters() self.process_start = sysstats.process_io_counters(self.process) if self.process_start: logger.info("Using more accurate process-based I/O counters.") else: logger.warn( "Process I/O counters are unsupported on this platform. Falling back to less accurate disk I/O counters." ) while not self.stop: self.metrics_store.put_value_node_level( self.node.node_name, "cpu_utilization_1s_%s" % self.phase.name, sysstats.cpu_utilization(self.process), "%")
def finish(self): self.stop = True self.join() # Be aware the semantics of write counts etc. are different for disk and process statistics. # Thus we're conservative and only report I/O bytes now. disk_end = sysstats.disk_io_counters() process_end = sysstats.process_io_counters(self.process) self.metrics_store.put_count_node_level( self.node.node_name, "disk_io_write_bytes_%s" % self.phase.name, self.write_bytes(process_end, disk_end), "byte") self.metrics_store.put_count_node_level( self.node.node_name, "disk_io_read_bytes_%s" % self.phase.name, self.read_bytes(process_end, disk_end), "byte")
def on_benchmark_stop(self): if self.process is not None: # Be aware the semantics of write counts etc. are different for disk and process statistics. # Thus we're conservative and only report I/O bytes now. try: process_end = sysstats.process_io_counters( self.process) if self.process_start else None disk_end = sysstats.disk_io_counters( ) if self.disk_start else None self.metrics_store.put_count_node_level( self.node.node_name, "disk_io_write_bytes", self.write_bytes(process_end, disk_end), "byte") self.metrics_store.put_count_node_level( self.node.node_name, "disk_io_read_bytes", self.read_bytes(process_end, disk_end), "byte") except RuntimeError: logger.exception( "Could not determine I/O stats at benchmark end.")