

@wrap_exceptions
def get_process_io_counters(self):
    f = open(('/proc/%s/io' % self.pid))
    try:
        for line in f:
            if line.startswith('rchar'):
                read_count = int(line.split()[1])
            elif line.startswith('wchar'):
                write_count = int(line.split()[1])
            elif line.startswith('read_bytes'):
                read_bytes = int(line.split()[1])
            elif line.startswith('write_bytes'):
                write_bytes = int(line.split()[1])
        return nt_io(read_count, write_count, read_bytes, write_bytes)
    finally:
        f.close()

dataset/ETHPy150Open packages/psutil/psutil/_pslinux.py Process.get_process_io_counters/original