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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 #!/usr/bin/env python
2 # Copyright 2014 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file.
5
6 """A simple tool to go through histograms.xml and print out the owners for
7 histograms.
8 """
9
10 import xml.etree.ElementTree
11
12 DUMMY_OWNER = "Please list the metric's owners. Add more owner tags as needed."
13
14 def main():
15 tree = xml.etree.ElementTree.parse('histograms.xml')
16 root = tree.getroot()
17 assert root.tag == 'histogram-configuration'
18
19 root_children = root.getchildren()
20 histograms = None
21 for node in root_children:
22 if node.tag == 'histograms':
23 histograms = node
24 break
25 assert histograms != None
26
27 for histogram in histograms.getchildren():
28 if histogram.tag != 'histogram':
29 continue
30
31 name = histogram.attrib['name']
32 owners = []
33 obsolete = False
34 for node in histogram.getchildren():
35 if node.tag == 'obsolete':
36 obsolete = True
37 continue
38 if node.tag != 'owner':
39 continue
40 if node.text == DUMMY_OWNER:
41 continue
42 assert '@' in node.text
43 owners.append(node.text)
44
45 if not obsolete:
46 if owners:
47 print name, ' '.join(owners)
48 else:
49 print name, 'NO_OWNER'
50
51 if __name__ == '__main__':
52 main()
OLDNEW
« 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