Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(171)

Unified Diff: tools/telemetry/telemetry/internal/platform/profiler/oomkiller_profiler.py

Issue 1647513002: Delete tools/telemetry. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: tools/telemetry/telemetry/internal/platform/profiler/oomkiller_profiler.py
diff --git a/tools/telemetry/telemetry/internal/platform/profiler/oomkiller_profiler.py b/tools/telemetry/telemetry/internal/platform/profiler/oomkiller_profiler.py
deleted file mode 100644
index 4aa750f24ed02b4a6a6d126cf1b52acbd564b61c..0000000000000000000000000000000000000000
--- a/tools/telemetry/telemetry/internal/platform/profiler/oomkiller_profiler.py
+++ /dev/null
@@ -1,78 +0,0 @@
-# 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
-
-from telemetry.internal.util import binary_manager
-from telemetry.internal.backends.chrome import android_browser_finder
-from telemetry.internal.platform import profiler
-
-from devil.android.sdk import intent # pylint: disable=import-error
-
-class UnableToFindApplicationException(Exception):
- """Exception when unable to find a launched application"""
-
- def __init__(self, application):
- super(UnableToFindApplicationException, self).__init__()
- self.application = application
-
- def __str__(self):
- return repr(self.application)
-
-
-class OOMKillerProfiler(profiler.Profiler):
- """Android-specific, Launch the music application and check it is still alive
- at the end of the run."""
-
- def __init__(self, browser_backend, platform_backend, output_path, state):
- super(OOMKillerProfiler, self).__init__(
- browser_backend, platform_backend, output_path, state)
- if not 'mem_consumer_launched' in state:
- state['mem_consumer_launched'] = True
- arch_name = self._browser_backend.device.GetABI()
- mem_consumer_path = binary_manager.FetchPath(
- os.path.join('apks', 'MemConsumer.apk'), arch_name, 'android')
- assert mem_consumer_path, ('Could not find memconsumer app. Please build '
- 'memconsumer target.')
- if not self._platform_backend.CanLaunchApplication(
- 'org.chromium.memconsumerg'):
- self._platform_backend.InstallApplication(mem_consumer_path)
- self._browser_backend.device.GoHome()
- self._platform_backend.LaunchApplication(
- 'org.chromium.memconsumer/.MemConsumer',
- '--ei memory 20')
- # Bring the browser to the foreground after launching the mem consumer
- self._browser_backend.device.StartActivity(
- intent.Intent(package=browser_backend.package,
- activity=browser_backend.activity),
- blocking=True)
-
- @classmethod
- def name(cls):
- return 'oomkiller'
-
- @classmethod
- def is_supported(cls, browser_type):
- if browser_type == 'any':
- return android_browser_finder.CanFindAvailableBrowsers()
- return browser_type.startswith('android')
-
- @classmethod
- def WillCloseBrowser(cls, browser_backend, platform_backend):
- browser_backend.device.ForceStop('org.chromium.memconsumer')
-
- def CollectProfile(self):
- missing_applications = self._MissingApplications()
- if not len(missing_applications):
- return []
- raise UnableToFindApplicationException(', '.join(missing_applications))
-
- def _MissingApplications(self):
- # TODO(qsr): Add com.android.launcher to the list, when the reason why the
- # launcher is often killed is understood.
- must_have_apps = [
- 'org.chromium.memconsumer',
- ]
- return [app for app in must_have_apps if
- not self._platform_backend.IsApplicationRunning(app)]

Powered by Google App Engine
This is Rietveld 408576698