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 ba975996719ce541a07445cf4a3a4c4cefb4cd23..ea4e9ddc6514c8d0074beacec5a2f66e75ac126a 100644 |
--- a/tools/metrics/histograms/update_histogram_enum.py |
+++ b/tools/metrics/histograms/update_histogram_enum.py |
@@ -142,6 +142,29 @@ def UpdateHistogramDefinitions(histogram_enum_name, source_enum_values, |
enum_node.appendChild(new_item_nodes[value]) |
+def HistogramNeedsUpdate(histogram_enum_name, source_enum_path, start_marker, |
+ end_marker): |
+ Log('Reading histogram enum definition from "{0}".'.format(source_enum_path)) |
+ source_enum_values = ReadHistogramValues(source_enum_path, start_marker, |
+ end_marker) |
+ |
+ HISTOGRAMS_PATH = path_util.GetHistogramsFile() |
+ |
+ Log('Reading existing histograms from "{0}".'.format(HISTOGRAMS_PATH)) |
+ with open(HISTOGRAMS_PATH, 'rb') as f: |
+ histograms_doc = minidom.parse(f) |
+ f.seek(0) |
+ xml = f.read() |
+ |
+ Log('Comparing histograms enum with new enum definition.') |
+ UpdateHistogramDefinitions(histogram_enum_name, source_enum_values, |
+ source_enum_path, histograms_doc) |
+ |
+ new_xml = print_style.GetPrintStyle().PrettyPrintNode(histograms_doc) |
Ilya Sherman
2016/03/02 00:59:29
It looks like you copy/pasted lines 151-163 here.
suzyh_UTC10 (ex-contributor)
2016/03/02 03:23:49
Done. It's a bit messy, but I haven't been able to
Ilya Sherman
2016/03/02 23:18:46
Thanks! This is the structure that I was thinking
|
+ |
+ return xml != new_xml |
+ |
+ |
def UpdateHistogramFromDict(histogram_enum_name, source_enum_values, |
source_enum_path): |
"""Updates |histogram_enum_name| enum in histograms.xml file with values |