Chromium Code Reviews| Index: tools/metrics/histograms/print_style.py |
| diff --git a/tools/perf/benchmarks/rasterize_and_record.py b/tools/metrics/histograms/print_style.py |
| similarity index 10% |
| copy from tools/perf/benchmarks/rasterize_and_record.py |
| copy to tools/metrics/histograms/print_style.py |
| index 79606d6834c2020b2a93a769a29aa90e175c047a..cd2e147f3c326cc4362bb9d193def08683e25515 100644 |
| --- a/tools/perf/benchmarks/rasterize_and_record.py |
| +++ b/tools/metrics/histograms/print_style.py |
| @@ -1,30 +1,57 @@ |
| # Copyright 2013 The Chromium Authors. All rights reserved. |
|
Alexei Svitkine (slow)
2014/02/20 22:50:55
Nit: 2014
yao
2014/02/24 19:16:23
Done.
|
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
|
Ilya Sherman
2014/02/22 07:07:37
nit: Please leave a blank line after this one.
yao
2014/02/24 19:16:23
Done.
|
| -from telemetry import test |
| - |
| -from measurements import rasterize_and_record |
| - |
| - |
| -class RasterizeAndRecordTop25(test.Test): |
| - """Measures rasterize and record performance on the top 25 web pages. |
| - |
| - http://www.chromium.org/developers/design-documents/rendering-benchmarks""" |
| - test = rasterize_and_record.RasterizeAndRecord |
| - page_set = 'page_sets/top_25.json' |
| - |
| - |
| -class RasterizeAndRecordKeyMobileSites(test.Test): |
| - """Measures rasterize and record performance on the key mobile sites. |
| - |
| - http://www.chromium.org/developers/design-documents/rendering-benchmarks""" |
| - test = rasterize_and_record.RasterizeAndRecord |
| - page_set = 'page_sets/key_mobile_sites.json' |
| - |
| - |
| -class RasterizeAndRecordSilk(test.Test): |
| - """Measures rasterize and record performance on the silk sites. |
| - |
| - http://www.chromium.org/developers/design-documents/rendering-benchmarks""" |
| - test = rasterize_and_record.RasterizeAndRecord |
| - page_set = 'page_sets/key_silk_cases.json' |
| +"""Holds the constants for pretty printing histograms.xml.""" |
|
Ilya Sherman
2014/02/22 07:07:37
Ditto.
yao
2014/02/24 19:16:23
Done.
|
| +import os |
| +import sys |
| + |
| +# Import the metrics/common module for pretty print xml. |
| +sys.path.append(os.path.join(os.path.dirname(__file__), '..', 'common')) |
| +import pretty_print_xml |
| + |
| +# Desired order for tag attributes; attributes listed here will appear first, |
| +# and in the same order as in these lists. |
| +# { tag_name: [attribute_name, ...] } |
| +ATTRIBUTE_ORDER = { |
| + 'enum': ['name', 'type'], |
| + 'histogram': ['name', 'enum', 'units'], |
| + 'int': ['value', 'label'], |
| + 'fieldtrial': ['name', 'separator', 'ordering'], |
| + 'group': ['name', 'label'], |
| + 'affected-histogram': ['name'], |
| + 'with-group': ['name'], |
| +} |
| + |
| +# Tag names for top-level nodes whose children we don't want to indent. |
| +TAGS_THAT_DONT_INDENT = [ |
| + 'histogram-configuration', |
| + 'histograms', |
| + 'fieldtrials', |
| + 'enums' |
| +] |
| + |
| +# Extra vertical spacing rules for special tag names. |
| +# {tag_name: (newlines_after_open, newlines_before_close, newlines_after_close)} |
| +TAGS_THAT_HAVE_EXTRA_NEWLINE = { |
| + 'histogram-configuration': (2, 1, 1), |
| + 'histograms': (2, 1, 1), |
| + 'fieldtrials': (2, 1, 1), |
| + 'enums': (2, 1, 1), |
| + 'histogram': (1, 1, 1), |
| + 'enum': (1, 1, 1), |
| + 'fieldtrial': (1, 1, 1), |
| +} |
| + |
| +# Tags that we allow to be squished into a single line for brevity. |
| +TAGS_THAT_ALLOW_SINGLE_LINE = [ |
| + 'summary', |
| + 'int', |
| +] |
| + |
| + |
| +def GetPrintStyle(): |
| + """Returns an XmlStyle object for pretty printing histograms.""" |
| + return pretty_print_xml.XmlStyle(ATTRIBUTE_ORDER, |
| + TAGS_THAT_HAVE_EXTRA_NEWLINE, |
| + TAGS_THAT_DONT_INDENT, |
| + TAGS_THAT_ALLOW_SINGLE_LINE) |