def gather_sample(self, stat_file):
        for line in stat_file:
            # Each line has a format of:
            # Tag: Value
            #
            # We parse out all lines looking like that and match the stats we care about.
            m = re.search('^(\w+):\s*(\d+)', line)
            if m is None:
                continue

            field_name = m.group(1)
            int_value = int(m.group(2))
            # FDSize is not the same as the number of open file descriptors. Disable
            # for now.
            # if field_name == "FDSize":
            #     self.print_sample("app.fd", int_value)
            if field_name == "VmSize":
                self.print_sample("app.mem.bytes", int_value * 1024,
                                  "vmsize")
            elif field_name == "VmPeak":
                self.print_sample("app.mem.bytes", int_value * 1024,
                                  "peak_vmsize")
            elif field_name == "VmRSS":
                self.print_sample("app.mem.bytes", int_value * 1024,
                                  "resident")
            elif field_name == "VmHWM":
                self.print_sample("app.mem.bytes", int_value * 1024,
                                  "peak_resident")


# Reads stats from /proc/$pid/io.
Gathers the metrics from the status file.
dataset/ETHPy150Open scalyr/scalyr-agent-2/scalyr_agent/builtin_monitors/linux_process_metrics.py/StatusReader.gather_sample