parameters: (device, interval_adjuster, event_tags_re, end_tag)
return_statement: return record
docstring: Measures the boot time once.
docstring_summary: Measures the boot time once.
docstring_tokens: Measures the boot time once .
function: def do_iteration(device, interval_adjuster, event_tags_re, end_tag):
      """Measures the boot time once."""
      device.wait()
      interval_adjuster.wait()
      device.reboot()
      print('Rebooted the device, waiting for tag', end_tag)
      record = {}
      booted = False
      while not booted:
          device.wait()
          # Stop the iteration if it does not finish within 120 seconds.
          timeout = 120
          t = WatchdogTimer(timeout)
          p = subprocess.Popen(
                  ['adb', 'logcat', '-b', 'events', '-v', 'threadtime'],
                  stdout=subprocess.PIPE)
          for line in readlines_unbuffered(p):
              if t.is_timedout():
                  print('*** Timed out ***')
                  return record
              m = event_tags_re.search(line)
              if not m:
                  continue
              tag = m.group('tag')
              event_time = int(m.group('time'))
              pid = m.group('pid')
              record[(tag, pid)] = event_time
              print(('Event log recorded: %s (%s) - %d ms' % (
                  tag, pid, event_time)))
              if tag == end_tag:
                  booted = True
                  t.cancel()
                  break
      return record
function_tokens: def do_iteration ( device , interval_adjuster , event_tags_re , end_tag ) : device . wait ( ) interval_adjuster . wait ( ) device . reboot ( ) print ( 'Rebooted the device, waiting for tag' , end_tag ) record = { } booted = False while not booted : device . wait ( ) # Stop the iteration if it does not finish within 120 seconds. timeout = 120 t = WatchdogTimer ( timeout ) p = subprocess . Popen ( [ 'adb' , 'logcat' , '-b' , 'events' , '-v' , 'threadtime' ] , stdout = subprocess . PIPE ) for line in readlines_unbuffered ( p ) : if t . is_timedout ( ) : print ( '*** Timed out ***' ) return record m = event_tags_re . search ( line ) if not m : continue tag = m . group ( 'tag' ) event_time = int ( m . group ( 'time' ) ) pid = m . group ( 'pid' ) record [ ( tag , pid ) ] = event_time print ( ( 'Event log recorded: %s (%s) - %d ms' % ( tag , pid , event_time ) ) ) if tag == end_tag : booted = True t . cancel ( ) break return record