Index: tools/metrics/histograms/update_histogram_enum.py |
diff --git a/tools/metrics/histograms/update_histogram_enum.py b/tools/metrics/histograms/update_histogram_enum.py |
index 03acea78e3ce9af32b8383fbba3526da4ac96ff3..5a151e3b4cafb9705106ca67e112a719701d97f5 100644 |
--- a/tools/metrics/histograms/update_histogram_enum.py |
+++ b/tools/metrics/histograms/update_histogram_enum.py |
@@ -136,20 +136,15 @@ def UpdateHistogramDefinitions(histogram_enum_name, source_enum_values, |
enum_node.appendChild(child) |
-def UpdateHistogramEnum(histogram_enum_name, source_enum_path, |
- start_marker, end_marker): |
+def UpdateHistogramFromDict(histogram_enum_name, source_enum_values, |
+ source_enum_path): |
Ilya Sherman
2014/05/13 03:11:33
nit: Please document the source_enum_path paramete
Mike Lawther (Google)
2014/05/20 07:45:03
Done.
|
"""Updates |histogram_enum_name| enum in histograms.xml file with values |
- read from |source_enum_path|, where |start_marker| and |end_marker| indicate |
- the beginning and end of the source enum definition, respectively. |
+ from the {value: 'key'} dictionary |source_enum_values| |
Ilya Sherman
2014/05/13 03:11:33
nit: Please end the sentence with a period.
Mike Lawther (Google)
2014/05/20 07:45:03
Done.
|
""" |
# TODO(ahernandez.miralles): The line below is present in nearly every |
# file in this directory; factor out into a central location |
HISTOGRAMS_PATH = 'histograms.xml' |
- Log('Reading histogram enum definition from "{0}".'.format(source_enum_path)) |
- source_enum_values = ReadHistogramValues(source_enum_path, start_marker, |
- end_marker) |
- |
Log('Reading existing histograms from "{0}".'.format(HISTOGRAMS_PATH)) |
with open(HISTOGRAMS_PATH, 'rb') as f: |
histograms_doc = minidom.parse(f) |
@@ -171,3 +166,18 @@ def UpdateHistogramEnum(histogram_enum_name, source_enum_path, |
f.write(new_xml) |
Log('Done.') |
+ |
+ |
+def UpdateHistogramEnum(histogram_enum_name, source_enum_path, |
+ start_marker, end_marker): |
+ """Updates |histogram_enum_name| enum in histograms.xml file with values |
+ read from |source_enum_path|, where |start_marker| and |end_marker| indicate |
+ the beginning and end of the source enum definition, respectively. |
+ """ |
+ |
+ Log('Reading histogram enum definition from "{0}".'.format(source_enum_path)) |
+ source_enum_values = ReadHistogramValues(source_enum_path, start_marker, |
+ end_marker) |
+ |
+ UpdateHistogramFromDict(histogram_enum_name, source_enum_values, |
+ source_enum_path) |