'Collects the stats.'

def Collect(self):

    cpu_times = self.proc.cpu_times()
    user = cpu_times.user
    system = cpu_times.system
    percent = self.proc.cpu_percent()
    self.cpu_samples.append((rdfvalue.RDFDatetime.Now(), user, system, percent))
    self.cpu_samples = self.cpu_samples[((-3600) / self.sleep_time):]
    try:
        (_, _, read_bytes, write_bytes) = self.proc.io_counters()
        self.io_samples.append((rdfvalue.RDFDatetime.Now(), read_bytes, write_bytes))
        self.io_samples = self.io_samples[((-3600) / self.sleep_time):]
    except (AttributeError, NotImplementedError, psutil.Error):
        pass
