summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorthestig@chromium.org <thestig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-08-09 01:22:15 +0000
committerthestig@chromium.org <thestig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-08-09 01:22:15 +0000
commit4d0725218ad613451917ee34849f646982bcae59 (patch)
tree15fc57af46cfbe541b7c00f7d585622929a64d6a /tools
parente5de60f79a1612f0a31223c8134f6c3b0af43a67 (diff)
downloadchromium_src-4d0725218ad613451917ee34849f646982bcae59.zip
chromium_src-4d0725218ad613451917ee34849f646982bcae59.tar.gz
chromium_src-4d0725218ad613451917ee34849f646982bcae59.tar.bz2
Metrics: Add a script to print out histogram ownership.
NOTRY=true Review URL: https://codereview.chromium.org/456943002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@288484 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'tools')
-rwxr-xr-xtools/metrics/histograms/histogram_ownership.py52
1 files changed, 52 insertions, 0 deletions
diff --git a/tools/metrics/histograms/histogram_ownership.py b/tools/metrics/histograms/histogram_ownership.py
new file mode 100755
index 0000000..0d13e6a
--- /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()