def gather_sample(self, stat_file):
        # The file format is just a single line of all the fields.
        line = stat_file.readlines()[0]
        # Chop off first part which is the pid and executable file. The
        # executable file is terminated with a paren so just search for that.
        line = line[(line.find(") ")+2):]
        fields = line.split()
        # Then the fields we want are just at fixed field positions in the
        # string.  Just grap them.
        self.print_sample("app.cpu", self.__calculate_time_cs(int(fields[11])), "user")
        self.print_sample("app.cpu",  self.__calculate_time_cs(int(fields[12])), "system")
        # The uptime is calculated by reading the 'start_time from stat which is expressed as the
        # number of jiffies after boot time when this process started.  So, convert away.
        process_uptime = self.__get_uptime_ms() - self.calculate_time_ms(int(fields[19]))
        self.print_sample("app.uptime", process_uptime)
        self.print_sample("app.nice", float(fields[16]))
        self.print_sample("app.threads", int(fields[17]))
Gathers the metrics from the stat file.
dataset/ETHPy150Open scalyr/scalyr-agent-2/scalyr_agent/builtin_monitors/linux_process_metrics.py/StatReader.gather_sample