class_docstr: This worker will send requests to a backend process, and measure the
  throughput and latency of those requests as well as GPU utilization.
docstr: This function will poll the response queue until it has received all
  responses. It records the startup latency, the average, max, min latency
  as well as througput of requests.
docstr_tok: ["This","function","will","poll","the","response","queue","until","it","has","received","all","responses",".","It","records","the","startup","latency",",","the","average",",","max",",","min","latency","as","well","as","througput","of","requests","."]
code: def _run_metrics(self, metrics_lock):
      """
      This function will poll the response queue until it has received all
      responses. It records the startup latency, the average, max, min latency
      as well as througput of requests.
      """
      warmup_response_time = None
      response_times = []
  
      for i in range(self.num_iters + 1):
          response, request_time = self.response_queue.get()
          if warmup_response_time is None:
              self.warmup_event.set()
              warmup_response_time = time.time() - request_time
          else:
              response_times.append(time.time() - request_time)
  
      self.end_recv_time = time.time()
      self.poll_gpu = False
  
      response_times = np.array(response_times)
      with metrics_lock:
          self.metrics_dict["warmup_latency"] = warmup_response_time
          self.metrics_dict["average_latency"] = response_times.mean()
          self.metrics_dict["max_latency"] = response_times.max()
          self.metrics_dict["min_latency"] = response_times.min()
          self.metrics_dict["throughput"] = (
              self.num_iters * self.batch_size
          ) / (self.end_recv_time - self.start_send_time)
  
imports: import argparse
  import asyncio
  import os.path
  import subprocess
  import threading
  import time
  from concurrent.futures import ThreadPoolExecutor
  from queue import Empty
  import numpy
  import pandas
  import torch
  import torch.multiprocessing
label_desc: Use image node_id 2 for calling the FrontendWorker obj's underlying member method code with example usage: obj._run_metrics(metrics_lock) without return types