def _read_swap_count(self): try: return dict((k, int(v)) for k, v in util.read_key_value_pairs_from_file('/proc/vmstat') if k in ['pswpin', 'pswpout']) except Exception as e: logging.warning('Cannot read swap count from kernel: %s', e)
def _read_swap_count(self): try: return dict( (k, int(v)) for k, v in util.read_key_value_pairs_from_file('/proc/vmstat') if k in ['pswpin', 'pswpout']) except Exception as e: logging.warning('Cannot read swap count from kernel: %s', e)
def _read_swap_count(self): try: return { k: int(v) for k, v in util.read_key_value_pairs_from_file("/proc/vmstat") if k in ["pswpin", "pswpout"] } except Exception as e: logging.warning("Cannot read swap count from kernel: %s", e)
def get_key_value_pairs(self, subsystem, filename): """ Read the lines of the given file from the given subsystem and split the lines into key-value pairs. Do not include the subsystem name in the option name. Only call this method if the given subsystem is available. """ assert subsystem in self return util.read_key_value_pairs_from_file(self.per_subsystem[subsystem], subsystem + '.' + filename)