Commit a979025a authored by Juan Antonio Navarro Perez's avatar Juan Antonio Navarro Perez Committed by Commit Bot

[cluster_telemetry] Remove browserless AnalysisMetricsCT

This benchmark is no longer used and was replaced by the
analyze_metrics_ct.py script.

Also removing no longer used dependencies:
- LocalTraceMeasurement, a TimelineBasedMeasurement only used by
  this benchmark;
- CTBrowserLessPageSet; and
- SharedBrowserlessStory.

Bug: 840428
Change-Id: I3f681c168ce3e46a8b51bfc49ae781b3b871add5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1619806
Commit-Queue: Juan Antonio Navarro Pérez <perezju@chromium.org>
Reviewed-by: default avatarRavi Mistry <rmistry@chromium.org>
Cr-Commit-Position: refs/heads/master@{#661337}
parent fd256a18
# Copyright 2018 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.
from core import perf_benchmark
from contrib.cluster_telemetry import ct_benchmarks_util
from contrib.cluster_telemetry import local_trace_measurement
from contrib.cluster_telemetry import page_set
from telemetry.web_perf import timeline_based_measurement
class AnalysisMetricsCT(perf_benchmark.PerfBenchmark):
"""Benchmark that reads in the provided local trace file and invokes TBMv2
metrics on that trace"""
test = local_trace_measurement.LocalTraceMeasurement
metric_name = "" # Set by ProcessCommandLineArgs.
def CreateCoreTimelineBasedMeasurementOptions(self):
tbm_options = timeline_based_measurement.Options()
tbm_options.AddTimelineBasedMetric(AnalysisMetricsCT.metric_name)
return tbm_options
@classmethod
def AddBenchmarkCommandLineArgs(cls, parser):
super(AnalysisMetricsCT, cls).AddBenchmarkCommandLineArgs(parser)
ct_benchmarks_util.AddBenchmarkCommandLineArgs(parser)
parser.add_option('--local-trace-path', type='string',
default=None,
help='The local path to the trace file')
parser.add_option('--cloud-trace-link', type='string',
default=None,
help='Cloud link from where the local trace file was ' +
'downloaded')
parser.add_option('--metric-name', type='string',
default=None,
help='The metric to parse the trace with')
@classmethod
def ProcessCommandLineArgs(cls, parser, args):
if not args.local_trace_path:
parser.error('Please specify --local-trace-path')
if not args.cloud_trace_link:
parser.error('Please specify --cloud-trace-link')
if not args.metric_name:
parser.error('Please specify --metric-name')
cls.metric_name = args.metric_name
def CreateStorySet(self, options):
return page_set.CTBrowserLessPageSet(options.local_trace_path,
options.cloud_trace_link)
@classmethod
def Name(cls):
return 'analysis_metrics_ct'
# Copyright 2018 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 logging
import os
import time
from telemetry.value import common_value_helpers
from telemetry.web_perf import timeline_based_measurement
from tracing.metrics import metric_runner
class LocalTraceMeasurement(
timeline_based_measurement.TimelineBasedMeasurement):
"""Collects metrics from the provided trace file."""
def __init__(self, options, results_wrapper=None):
super(LocalTraceMeasurement, self).__init__(options, results_wrapper)
def WillRunStory(self, platform):
"""Executes any necessary actions before running the story."""
pass
def Measure(self, platform, results):
"""Collect all possible metrics and add them to results."""
# Extract the file name without the "file:/" prefix.
assert results.current_page.name.startswith("file:/"), \
"current page path should start with file:/"
filename = results.current_page.name[len("file:/"):]
metrics = self._tbm_options.GetTimelineBasedMetrics()
extra_import_options = {
'trackDetailedModelStats': True
}
trace_size_in_mib = os.path.getsize(filename) / (2 ** 20)
# Bails out on trace that are too big. See crbug.com/812631 for more
# details.
if trace_size_in_mib > 400:
results.Fail('Trace size is too big: %s MiB' % trace_size_in_mib)
return
logging.warning('Starting to compute metrics on trace')
start = time.time()
mre_result = metric_runner.RunMetric(
filename, metrics, extra_import_options,
report_progress=False,
canonical_url=results.current_page.cloud_trace_link)
logging.warning('Processing resulting traces took %.3f seconds' % (
time.time() - start))
page = results.current_page
for f in mre_result.failures:
results.Fail(f.stack)
histogram_dicts = mre_result.pairs.get('histograms', [])
results.ImportHistogramDicts(histogram_dicts)
for d in mre_result.pairs.get('scalars', []):
results.AddValue(common_value_helpers.TranslateScalarValue(d, page))
def DidRunStory(self, platform, results):
"""Clean up after running the story."""
pass
......@@ -2,8 +2,6 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from contrib.cluster_telemetry import shared_browserless_story
from telemetry.page import cache_temperature as cache_temperature_module
from telemetry.page import traffic_setting as traffic_setting_module
from telemetry.page import page as page_module
......@@ -39,28 +37,6 @@ class CTPage(page_module.Page):
self._run_page_interaction_callback(action_runner)
class LocalTracePath(story.Story):
def __init__(self, local_trace_path, cloud_trace_link, shared_state_class):
super(LocalTracePath, self).__init__(
shared_state_class=shared_state_class,
name=local_trace_path)
self.cloud_trace_link = cloud_trace_link
def Run(self, shared_state):
pass
class CTBrowserLessPageSet(story.StorySet):
"""Page set used by CT Benchmarks that do not require a browser."""
def __init__(self, local_trace_path, cloud_trace_link):
super(CTBrowserLessPageSet, self).__init__()
shared_state_class = shared_browserless_story.SharedBrowserlessStory
self.AddStory(
LocalTracePath(
local_trace_path=local_trace_path,
cloud_trace_link=cloud_trace_link,
shared_state_class=shared_state_class))
class CTPageSet(story.StorySet):
"""Page set used by CT Benchmarks."""
......
# Copyright 2018 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.
from telemetry import story as story_module
from telemetry.core import platform as p_module
class SharedBrowserlessStory(story_module.SharedState):
"""
This class subclasses story_module.SharedState and removes all logic required
to bring up a browser that is found in shared_page_state.SharedPageState.
"""
def __init__(self, test, finder_options, story_set, possible_browser=None):
super(SharedBrowserlessStory, self).__init__(
test, finder_options, story_set, possible_browser)
@property
def platform(self):
p_module.GetHostPlatform()
def WillRunStory(self, unused_page):
return
def DidRunStory(self, results):
return
def CanRunStory(self, unused_page):
return True
def RunStory(self, results):
return
def TearDownState(self):
pass
def DumpStateUponFailure(self, story, results):
pass
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment