Esempio n. 1
0
  def test_construct_adb_shell_command(self):
    command = util.construct_adb_shell_command(LIST_TMP_ARGS, None)
    self.assertEqual(' '.join(command), 'adb shell ls /data/local/tmp')

    command = util.construct_adb_shell_command(LIST_TMP_ARGS, DEVICE_SERIAL)
    self.assertEqual(' '.join(command),
                     'adb -s AG8404EC0444AGC shell ls /data/local/tmp')

    command = util.construct_adb_shell_command(ATRACE_ARGS, DEVICE_SERIAL)
    self.assertEqual(' '.join(command),
                     'adb -s AG8404EC0444AGC shell atrace -z -t 10 -b 4096')
Esempio n. 2
0
  def test_construct_adb_shell_command(self):
    command = util.construct_adb_shell_command(LIST_TMP_ARGS, None)
    self.assertEqual(' '.join(command), 'adb shell ls /data/local/tmp')

    command = util.construct_adb_shell_command(LIST_TMP_ARGS, DEVICE_SERIAL)
    self.assertEqual(' '.join(command),
                     'adb -s AG8404EC0444AGC shell ls /data/local/tmp')

    command = util.construct_adb_shell_command(ATRACE_ARGS, DEVICE_SERIAL)
    self.assertEqual(' '.join(command),
                     'adb -s AG8404EC0444AGC shell atrace -z -t 10 -b 4096')
Esempio n. 3
0
def _construct_boot_trace_command(config):
    atrace_args = ['atrace', '--async_stop']
    setprop_args = ['setprop', BOOTTRACE_PROP, '0']
    rm_args = ['rm', BOOTTRACE_CATEGORIES]
    return util.construct_adb_shell_command(
        atrace_args + ['&&'] + setprop_args + ['&&'] + rm_args,
        config.device_serial_number)
Esempio n. 4
0
def _construct_boot_trace_command(options):
  atrace_args = ['atrace', '--async_stop']
  setprop_args = ['setprop', BOOTTRACE_PROP, '0']
  rm_args = ['rm', BOOTTRACE_CATEGORIES]
  return util.construct_adb_shell_command(
        atrace_args + ['&&'] + setprop_args + ['&&'] + rm_args,
        options.device_serial_number)
Esempio n. 5
0
def _construct_boot_setup_command(options, categories):
  echo_args = ['echo'] + categories + ['>', BOOTTRACE_CATEGORIES]
  setprop_args = ['setprop', BOOTTRACE_PROP, '1']
  reboot_args = ['reboot']
  return util.construct_adb_shell_command(
      echo_args + ['&&'] + setprop_args + ['&&'] + reboot_args,
      options.device_serial_number)
Esempio n. 6
0
 def _construct_setup_command(self):
     echo_args = ['echo'] + self._categories + ['>', BOOTTRACE_CATEGORIES]
     setprop_args = ['setprop', BOOTTRACE_PROP, '1']
     reboot_args = ['reboot']
     return util.construct_adb_shell_command(
         echo_args + ['&&'] + setprop_args + ['&&'] + reboot_args,
         self._options.device_serial)
Esempio n. 7
0
def _construct_boot_setup_command(config):
    echo_args = (['echo'] + config.atrace_categories +
                 ['>', BOOTTRACE_CATEGORIES])
    setprop_args = ['setprop', BOOTTRACE_PROP, '1']
    reboot_args = ['reboot']
    return util.construct_adb_shell_command(
        echo_args + ['&&'] + setprop_args + ['&&'] + reboot_args,
        config.device_serial_number)
Esempio n. 8
0
def _construct_boot_setup_command(config):
  echo_args = (['echo'] + config.atrace_categories +
               ['>', BOOTTRACE_CATEGORIES])
  setprop_args = ['setprop', BOOTTRACE_PROP, '1']
  reboot_args = ['reboot']
  return util.construct_adb_shell_command(
      echo_args + ['&&'] + setprop_args + ['&&'] + reboot_args,
      config.device_serial_number)
Esempio n. 9
0
 def _construct_trace_command(self):
     self._expect_trace = True
     atrace_args = ['atrace', '--async_stop']
     setprop_args = ['setprop', BOOTTRACE_PROP, '0']
     rm_args = ['rm', BOOTTRACE_CATEGORIES]
     return util.construct_adb_shell_command(
         atrace_args + ['&&'] + setprop_args + ['&&'] + rm_args,
         self._options.device_serial)
Esempio n. 10
0
 def _construct_trace_command(self):
   self._expect_trace = True
   atrace_args = ['atrace', '--async_stop']
   setprop_args = ['setprop', BOOTTRACE_PROP, '0']
   rm_args = ['rm', BOOTTRACE_CATEGORIES]
   return util.construct_adb_shell_command(
         atrace_args + ['&&'] + setprop_args + ['&&'] + rm_args,
         self._options.device_serial)
Esempio n. 11
0
    def _construct_trace_command(self):
        """Builds a command-line used to invoke a trace process.

    Returns:
      A tuple where the first element is an array of command-line arguments, and
      the second element is a boolean which will be true if the commend will
      stream trace data.
    """
        if self._options.list_categories:
            tracer_args = self._construct_list_categories_command()
            self._expect_trace = False
        elif self._options.from_file is not None:
            tracer_args = ['cat', self._options.from_file]
            self._expect_trace = True
        else:
            atrace_args = ATRACE_BASE_ARGS[:]
            self._expect_trace = True
            if self._options.compress_trace_data:
                atrace_args.extend(['-z'])

            if ((self._options.trace_time is not None)
                    and (self._options.trace_time > 0)):
                atrace_args.extend(['-t', str(self._options.trace_time)])

            if ((self._options.trace_buf_size is not None)
                    and (self._options.trace_buf_size > 0)):
                atrace_args.extend(['-b', str(self._options.trace_buf_size)])
            elif 'sched' in self._categories:
                # 'sched' is a high-volume tag, double the default buffer size
                # to accommodate that
                atrace_args.extend(['-b', '4096'])
            extra_args = self._construct_extra_trace_command()
            atrace_args.extend(extra_args)

            tracer_args = util.construct_adb_shell_command(
                atrace_args, self._options.device_serial)

        return tracer_args
Esempio n. 12
0
  def _construct_trace_command(self):
    """Builds a command-line used to invoke a trace process.

    Returns:
      A tuple where the first element is an array of command-line arguments, and
      the second element is a boolean which will be true if the commend will
      stream trace data.
    """
    if self._options.list_categories:
      tracer_args = self._construct_list_categories_command()
      self._expect_trace = False
    elif self._options.from_file is not None:
      tracer_args = ['cat', self._options.from_file]
      self._expect_trace = True
    else:
      atrace_args = ATRACE_BASE_ARGS[:]
      self._expect_trace = True
      if self._options.compress_trace_data:
        atrace_args.extend(['-z'])

      if ((self._options.trace_time is not None)
          and (self._options.trace_time > 0)):
        atrace_args.extend(['-t', str(self._options.trace_time)])

      if ((self._options.trace_buf_size is not None)
          and (self._options.trace_buf_size > 0)):
        atrace_args.extend(['-b', str(self._options.trace_buf_size)])
      elif 'sched' in self._categories:
        # 'sched' is a high-volume tag, double the default buffer size
        # to accommodate that
        atrace_args.extend(['-b', '4096'])
      extra_args = self._construct_extra_trace_command()
      atrace_args.extend(extra_args)

      tracer_args = util.construct_adb_shell_command(
          atrace_args, self._options.device_serial)

    return tracer_args
Esempio n. 13
0
 def _construct_list_categories_command(self):
     return util.construct_adb_shell_command(LIST_CATEGORIES_ARGS,
                                             self._options.device_serial)
Esempio n. 14
0
 def _construct_list_categories_command(self):
   return util.construct_adb_shell_command(
         LIST_CATEGORIES_ARGS, self._options.device_serial)