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

Unified Diff: tools/metrics/histograms/histogram_ownership.py

Issue 456943002: Metrics: Add a script to print out histogram ownership. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: upload from git Created 6 years, 4 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/metrics/histograms/histogram_ownership.py
diff --git a/tools/metrics/histograms/histogram_ownership.py b/tools/metrics/histograms/histogram_ownership.py
new file mode 100755
index 0000000000000000000000000000000000000000..0d13e6abf1eeb6450306d810bae4354ed098b17a
--- /dev/null
+++ b/tools/metrics/histograms/histogram_ownership.py
@@ -0,0 +1,52 @@
+#!/usr/bin/env python
+# Copyright 2014 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""A simple tool to go through histograms.xml and print out the owners for
+histograms.
+"""
+
+import xml.etree.ElementTree
+
+DUMMY_OWNER = "Please list the metric's owners. Add more owner tags as needed."
+
+def main():
+ tree = xml.etree.ElementTree.parse('histograms.xml')
+ root = tree.getroot()
+ assert root.tag == 'histogram-configuration'
+
+ root_children = root.getchildren()
+ histograms = None
+ for node in root_children:
+ if node.tag == 'histograms':
+ histograms = node
+ break
+ assert histograms != None
+
+ for histogram in histograms.getchildren():
+ if histogram.tag != 'histogram':
+ continue
+
+ name = histogram.attrib['name']
+ owners = []
+ obsolete = False
+ for node in histogram.getchildren():
+ if node.tag == 'obsolete':
+ obsolete = True
+ continue
+ if node.tag != 'owner':
+ continue
+ if node.text == DUMMY_OWNER:
+ continue
+ assert '@' in node.text
+ owners.append(node.text)
+
+ if not obsolete:
+ if owners:
+ print name, ' '.join(owners)
+ else:
+ print name, 'NO_OWNER'
+
+if __name__ == '__main__':
+ main()
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698