class_docstr: Logs the elapsed time.
  
  The values are displayed and/or output to the file
  ``<name>-timer.txt``.
  
  Example:
  
  .. code-block:: python
  
      import time
      mont = MonitorTimeElapsed("time", interval=2)
      for i in range(10):
          time.sleep(1)
          mont.add(i)
  
  Args:
      name (str): Name of the monitor. Used in the log.
      monitor (~nnabla.monitor.Monitor): Monitor class instance.
      interval (int): Interval of flush the outputs.
          The elapsed time is calculated within the interval.
      verbose (bool): Output to screen.
class_docstr_tok: ["Logs","the","elapsed","time",".","The","values","are","displayed","and\/or","output","to","the","file","``","<","name",">","-timer.txt","``",".","Example",":","..","code-block",":",":","python","import","time","mont","=","MonitorTimeElapsed","(","``","time","''",",","interval=2",")","for","i","in","range","(","10",")",":","time.sleep","(","1",")","mont.add","(","i",")","Args",":","name","(","str",")",":","Name","of","the","monitor",".","Used","in","the","log",".","monitor","(","~nnabla.monitor.Monitor",")",":","Monitor","class","instance",".","interval","(","int",")",":","Interval","of","flush","the","outputs",".","The","elapsed","time","is","calculated","within","the","interval",".","verbose","(","bool",")",":","Output","to","screen","."]
docstr: Calculate time elapsed from the point previously called
  this method or this object is created to this is called.
  
  Args:
      index (int): Index to be displayed, and be used to take intervals.
docstr_tok: ["Calculate","time","elapsed","from","the","point","previously","called","this","method","or","this","object","is","created","to","this","is","called",".","Args",":","index","(","int",")",":","Index","to","be","displayed",",","and","be","used","to","take","intervals","."]
code: def add(self, index):
      """Calculate time elapsed from the point previously called
      this method or this object is created to this is called.
  
      Args:
          index (int): Index to be displayed, and be used to take intervals.
  
      """
      if (index - self.flush_at) < self.interval:
          return
      now = time.time()
      elapsed = now - self.lap
      elapsed_total = now - self.start
      it = index - self.flush_at
      self.lap = now
      if self.verbose:
          logger.info(
              "iter={} {{{}}}={}[sec/{}iter] {}[sec]".format(
                  index, self.name, elapsed, it, elapsed_total
              )
          )
      if self.sp is not None:
          with open(self.sp, "a") as fd:
              print(
                  "{} {} {} {}".format(
                      index, elapsed, it, elapsed_total
                  ),
                  file=fd,
              )
      self.flush_at = index
  
imports: from __future__ import print_function
  import numpy
  import os
  import time
  from nnabla.logger import logger
label_desc: Use image node_id 2 for calling the MonitorTimeElapsed obj's underlying member method code with example usage: obj.add(index) without return types