<commit_before># Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

import os
import subprocess
import StringIO
import zipfile

from telemetry.core import util
from telemetry.core.backends.chrome import android_browser_finder
from telemetry.core.platform import profiler

_SYSTRACE_CATEGORIES = [
    'gfx',
    'input',
    'view',
    'sched',
    'freq',
]

class AndroidSystraceProfiler(profiler.Profiler):
  """Collects a Systrace on Android."""

  def __init__(self, browser_backend, platform_backend, output_path, state):
    super(AndroidSystraceProfiler, self).__init__(
        browser_backend, platform_backend, output_path, state)
    assert self._browser_backend.supports_tracing
    self._output_path = output_path + '-trace.zip'
    self._systrace_output_path = output_path + '.systrace'

    # Use telemetry's own tracing backend instead the combined mode in
    # adb_profile_chrome because some benchmarks also do tracing of their own
    # and the two methods conflict.
    self._browser_backend.StartTracing(None, timeout=10)
    self._profiler = subprocess.Popen(
        [os.path.join(util.GetChromiumSrcDir(),
                      'build', 'android', 'adb_profile_chrome.py'),
         '--categories', '', '--continuous', '--output',
         self._systrace_output_path, '--systrace'] + _SYSTRACE_CATEGORIES,
        stdin=subprocess.PIPE, stdout=subprocess.PIPE)

  @classmethod
  def name(cls):
    return 'android-systrace'

  @classmethod
  def is_supported(cls, browser_type):<commit_msg>Move adb_profile_chrome under tools/android/      Move adb_profile_chrome from build/android/ to tools/android/ to make its purpose clearer.      BUG=375754 TEST=tools/android/adb_profile_chrome/run_tests<commit_after># Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

import os
import subprocess
import StringIO
import zipfile

from telemetry.core import util
from telemetry.core.backends.chrome import android_browser_finder
from telemetry.core.platform import profiler

_SYSTRACE_CATEGORIES = [
    'gfx',
    'input',
    'view',
    'sched',
    'freq',
]

class AndroidSystraceProfiler(profiler.Profiler):
  """Collects a Systrace on Android."""

  def __init__(self, browser_backend, platform_backend, output_path, state):
    super(AndroidSystraceProfiler, self).__init__(
        browser_backend, platform_backend, output_path, state)
    assert self._browser_backend.supports_tracing
    self._output_path = output_path + '-trace.zip'
    self._systrace_output_path = output_path + '.systrace'

    # Use telemetry's own tracing backend instead the combined mode in
    # adb_profile_chrome because some benchmarks also do tracing of their own
    # and the two methods conflict.
    self._browser_backend.StartTracing(None, timeout=10)
    self._profiler = subprocess.Popen(
        ['python', os.path.join(util.GetChromiumSrcDir(), 'tools', 'android',
                                'adb_profile_chrome.py'),
         '--categories', '', '--continuous', '--output',
         self._systrace_output_path, '--systrace'] + _SYSTRACE_CATEGORIES,
        stdin=subprocess.PIPE, stdout=subprocess.PIPE)

  @classmethod
  def name(cls):
    return 'android-systrace'

  @classmethod
  def is_supported(cls, browser_type):
{'fraction_non_alphanumeric': 0.09379509379509379, 'fraction_numerical': 0.005194805194805195, 'mean_word_length': 3.8954802259887007, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6441583', 'n_tokens_mistral': 1086, 'n_tokens_neox': 1047, 'n_words': 278}