code: def collect_cost_time(self, comm, iter_n):
      if comm and iter_n % self._frequency == 0:
          t1 = timeit.default_timer()
          yield
          t2 = timeit.default_timer()
          self.timelist.append(t2 - t1)
          self._get_analysis(comm)
      else:
          yield
  
imports: import os
  import re
  import timeit
  from contextlib import contextmanager
  import nnabla
  import nnabla.utils.callback
  import numpy
  from nnabla.config import nnabla_config
  from nnabla.logger import logger
  from nnabla.utils import nnabla_pb2
  from nnabla.utils.communicator_util import current_communicator
  from nnabla.utils.get_file_handle import get_file_handle_save, get_decorated_file_loader, load_files
  from contextlib import contextmanager
  import nnabla.logger
  from nnabla.lms import SwapInOutScheduler
label_desc: Use image node_id 2 for calling the NodeTimeInfoCollector obj's underlying member method code with example usage: obj.collect_cost_time(comm, iter_n) without return types