Returns the client stats.

def Run(self, arg):
    """Returns the client stats."""
    if arg is None:
      arg = rdf_client_action.GetClientStatsRequest()

    proc = psutil.Process(os.getpid())
    meminfo = proc.memory_info()
    boot_time = rdfvalue.RDFDatetime.FromSecondsSinceEpoch(psutil.boot_time())
    create_time = rdfvalue.RDFDatetime.FromSecondsSinceEpoch(proc.create_time())
    stats_collector = stats_collector_instance.Get()
    response = rdf_client_stats.ClientStats(
        RSS_size=meminfo.rss,
        VMS_size=meminfo.vms,
        memory_percent=proc.memory_percent(),
        bytes_received=stats_collector.GetMetricValue(
            "grr_client_received_bytes"),
        bytes_sent=stats_collector.GetMetricValue("grr_client_sent_bytes"),
        create_time=create_time,
        boot_time=boot_time)

    response.cpu_samples = self.grr_worker.stats_collector.CpuSamplesBetween(
        start_time=arg.start_time, end_time=arg.end_time)
    response.io_samples = self.grr_worker.stats_collector.IOSamplesBetween(
        start_time=arg.start_time, end_time=arg.end_time)

    self.Send(response)