content: import time
  
  class Timer:
      def __enter__(self):
          self.start = time.time()
          return self
  
      def __exit__(self, exc_type, exc_val, exc_tb):
          self.end = time.time()
          self.interval = self.end - self.start
          print(f"耗时 {self.interval*1000} ms")
  
  with Timer():
      ...