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

Unified Diff: tools/telemetry/telemetry/benchmark.py

Issue 840043004: Add trace rerun options to benchmark and pass them through chartjson. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Cleanup. Created 5 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
« no previous file with comments | « no previous file | tools/telemetry/telemetry/results/chart_json_output_formatter.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/telemetry/telemetry/benchmark.py
diff --git a/tools/telemetry/telemetry/benchmark.py b/tools/telemetry/telemetry/benchmark.py
index f32a1fd69477081d54ef0df3566d43c0c5173e81..c018acc81b9480df4a3181174e9fd4aa536c66f5 100644
--- a/tools/telemetry/telemetry/benchmark.py
+++ b/tools/telemetry/telemetry/benchmark.py
@@ -33,9 +33,10 @@ class InvalidOptionsError(Exception):
class BenchmarkMetadata(object):
- def __init__(self, name, description=''):
+ def __init__(self, name, description='', rerun_options=None):
self._name = name
self._description = description
+ self._rerun_options = rerun_options
@property
def name(self):
@@ -45,6 +46,10 @@ class BenchmarkMetadata(object):
def description(self):
return self._description
+ @property
+ def rerun_options(self):
+ return self._rerun_options
+
class Benchmark(command_line.Command):
"""Base class for a Telemetry benchmark.
@@ -86,12 +91,45 @@ class Benchmark(command_line.Command):
@classmethod
def AddCommandLineArgs(cls, parser):
+ group = optparse.OptionGroup(parser, '%s test options' % cls.Name())
if hasattr(cls, 'AddBenchmarkCommandLineArgs'):
- group = optparse.OptionGroup(parser, '%s test options' % cls.Name())
cls.AddBenchmarkCommandLineArgs(group)
+
+ if cls.HasTraceRerunDebugOption():
+ group.add_option(
+ '--rerun-with-debug-trace',
+ action='store_true',
+ help='Rerun option that enables more extensive tracing.')
+
+ if group.option_list:
parser.add_option_group(group)
@classmethod
+ def HasTraceRerunDebugOption(cls):
+ if hasattr(cls, 'HasBenchmarkTraceRerunDebugOption'):
+ if cls.HasBenchmarkTraceRerunDebugOption():
+ return True
+ return False
+
+ def GetTraceRerunCommands(self):
+ if self.HasTraceRerunDebugOption():
+ return [['Debug Trace', '--rerun-with-debug-trace']]
+ return []
+
+ def SetupTraceRerunOptions(self, browser_options, tbm_options):
+ if self.HasTraceRerunDebugOption():
+ if browser_options.rerun_with_debug_trace:
+ self.SetupBenchmarkDebugTraceRerunOptions(tbm_options)
+ else:
+ self.SetupBenchmarkDefaultTraceRerunOptions(tbm_options)
+
+ def SetupBenchmarkDefaultTraceRerunOptions(self, tbm_options):
+ """Setup tracing categories associated with default trace option."""
+
+ def SetupBenchmarkDebugTraceRerunOptions(self, tbm_options):
+ """Setup tracing categories associated with debug trace option."""
+
+ @classmethod
def SetArgumentDefaults(cls, parser):
default_values = parser.get_default_values()
invalid_options = [
@@ -109,7 +147,8 @@ class Benchmark(command_line.Command):
"""Add browser options that are required by this benchmark."""
def GetMetadata(self):
- return BenchmarkMetadata(self.Name(), self.__doc__)
+ return BenchmarkMetadata(
+ self.Name(), self.__doc__, self.GetTraceRerunCommands())
def Run(self, finder_options):
"""Run this test with the given options.
@@ -253,8 +292,10 @@ class Benchmark(command_line.Command):
'Cannot override CreateTimelineBasedMeasurementOptions '
'with a PageTest.')
return self.test() # pylint: disable=no-value-for-parameter
- return timeline_based_measurement.TimelineBasedMeasurement(
- self.CreateTimelineBasedMeasurementOptions())
+
+ opts = self.CreateTimelineBasedMeasurementOptions()
+ self.SetupTraceRerunOptions(options, opts)
+ return timeline_based_measurement.TimelineBasedMeasurement(opts)
def CreatePageSet(self, options): # pylint: disable=unused-argument
"""Get the page set this test will run on.
« no previous file with comments | « no previous file | tools/telemetry/telemetry/results/chart_json_output_formatter.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698