| Index: tools/metrics/histograms/print_style.py
|
| diff --git a/tools/metrics/histograms/print_style.py b/tools/metrics/histograms/print_style.py
|
| index 6b7064990c6141bb812ef69f4b3361a0c8ac26ca..21806657f2e9b77859b4a6a2eff39c92ede6c488 100644
|
| --- a/tools/metrics/histograms/print_style.py
|
| +++ b/tools/metrics/histograms/print_style.py
|
| @@ -17,12 +17,12 @@ import pretty_print_xml
|
| ATTRIBUTE_ORDER = {
|
| 'affected-histogram': ['name'],
|
| 'details': [],
|
| - 'enum': ['name', 'type'],
|
| + 'enum': ['name'],
|
| 'enums': [],
|
| 'histogram': ['base', 'name', 'enum', 'units'],
|
| 'histogram-configuration': ['logsource'],
|
| - 'histogram_suffixes': ['name', 'separator', 'ordering'],
|
| - 'histogram_suffixes_list': [],
|
| + 'histogram-suffixes': ['name', 'separator', 'ordering'],
|
| + 'histogram-suffixes-list': [],
|
| 'histograms': [],
|
| 'int': ['value', 'label'],
|
| 'obsolete': [],
|
| @@ -32,11 +32,20 @@ ATTRIBUTE_ORDER = {
|
| 'with-suffix': ['name'],
|
| }
|
|
|
| +# Attribute names that must be explicitly specified on nodes that support them.
|
| +REQUIRED_ATTRIBUTES = [
|
| + # TODO(isherman): Make the 'label' attribute required as well. This requires
|
| + # fixing up existing suffixes that omit a label.
|
| + 'name',
|
| + 'separator',
|
| + 'value',
|
| +]
|
| +
|
| # Tag names for top-level nodes whose children we don't want to indent.
|
| TAGS_THAT_DONT_INDENT = [
|
| 'histogram-configuration',
|
| 'histograms',
|
| - 'histogram_suffixes_list',
|
| + 'histogram-suffixes-list',
|
| 'enums',
|
| ]
|
|
|
| @@ -45,8 +54,8 @@ TAGS_THAT_DONT_INDENT = [
|
| TAGS_THAT_HAVE_EXTRA_NEWLINE = {
|
| 'histogram-configuration': (2, 1, 1),
|
| 'histograms': (2, 1, 1),
|
| - 'histogram_suffixes_list': (2, 1, 1),
|
| - 'histogram_suffixes': (1, 1, 1),
|
| + 'histogram-suffixes-list': (2, 1, 1),
|
| + 'histogram-suffixes': (1, 1, 1),
|
| 'enums': (2, 1, 1),
|
| 'histogram': (1, 1, 1),
|
| 'enum': (1, 1, 1),
|
| @@ -64,14 +73,15 @@ TAGS_ALPHABETIZATION_RULES = {
|
| 'histograms': ('histogram', LOWERCASE_NAME_FN),
|
| 'enums': ('enum', LOWERCASE_NAME_FN),
|
| 'enum': ('int', lambda n: int(n.attributes['value'].value)),
|
| - 'histogram_suffixes_list': ('histogram_suffixes', LOWERCASE_NAME_FN),
|
| - 'histogram_suffixes': ('affected-histogram', LOWERCASE_NAME_FN),
|
| + 'histogram-suffixes-list': ('histogram-suffixes', LOWERCASE_NAME_FN),
|
| + 'histogram-suffixes': ('affected-histogram', LOWERCASE_NAME_FN),
|
| }
|
|
|
|
|
| def GetPrintStyle():
|
| """Returns an XmlStyle object for pretty printing histograms."""
|
| return pretty_print_xml.XmlStyle(ATTRIBUTE_ORDER,
|
| + REQUIRED_ATTRIBUTES,
|
| TAGS_THAT_HAVE_EXTRA_NEWLINE,
|
| TAGS_THAT_DONT_INDENT,
|
| TAGS_THAT_ALLOW_SINGLE_LINE,
|
|
|