'Save cpu and network stats, check limits.'

def UpdateProtoResources(self, status):

    user_cpu = status.cpu_time_used.user_cpu_time
    system_cpu = status.cpu_time_used.system_cpu_time
    self.context.client_resources.cpu_usage.user_cpu_time += user_cpu
    self.context.client_resources.cpu_usage.system_cpu_time += system_cpu
    user_cpu_total = self.context.client_resources.cpu_usage.user_cpu_time
    system_cpu_total = self.context.client_resources.cpu_usage.system_cpu_time
    self.context.network_bytes_sent += status.network_bytes_sent
    if self.runner_args.cpu_limit:
        if (self.runner_args.cpu_limit < (user_cpu_total + system_cpu_total)):
            raise flow_runner.FlowRunnerError('CPU    limit    exceeded.')
    if self.runner_args.network_bytes_limit:
        if (self.runner_args.network_bytes_limit < self.context.network_bytes_sent):
            raise flow_runner.FlowRunnerError('Network    bytes    limit    exceeded.')
