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

Side by Side Diff: tools/metrics/histograms/histogram_ownership.py

Issue 1143323006: Histograms.xml python script housekeeping (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@bad_message
Patch Set: Fix imports (sadface) Created 5 years, 6 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
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright 2014 The Chromium Authors. All rights reserved. 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 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 """A simple tool to go through histograms.xml and print out the owners for 6 """A simple tool to go through histograms.xml and print out the owners for
7 histograms. 7 histograms.
8 """ 8 """
9 9
10 import os
11 import sys
10 import xml.etree.ElementTree 12 import xml.etree.ElementTree
11 13
14 sys.path.append(os.path.join(os.path.dirname(__file__), '..', 'common'))
15 import path_util
16
12 DUMMY_OWNER = "Please list the metric's owners. Add more owner tags as needed." 17 DUMMY_OWNER = "Please list the metric's owners. Add more owner tags as needed."
13 18
14 def main(): 19 def main():
15 tree = xml.etree.ElementTree.parse('histograms.xml') 20 tree = xml.etree.ElementTree.parse(path_util.GetHistogramsFile())
16 root = tree.getroot() 21 root = tree.getroot()
17 assert root.tag == 'histogram-configuration' 22 assert root.tag == 'histogram-configuration'
18 23
19 root_children = root.getchildren() 24 root_children = root.getchildren()
20 histograms = None 25 histograms = None
21 for node in root_children: 26 for node in root_children:
22 if node.tag == 'histograms': 27 if node.tag == 'histograms':
23 histograms = node 28 histograms = node
24 break 29 break
25 assert histograms != None 30 assert histograms != None
(...skipping 17 matching lines...) Expand all
43 owners.append(node.text) 48 owners.append(node.text)
44 49
45 if not obsolete: 50 if not obsolete:
46 if owners: 51 if owners:
47 print name, ' '.join(owners) 52 print name, ' '.join(owners)
48 else: 53 else:
49 print name, 'NO_OWNER' 54 print name, 'NO_OWNER'
50 55
51 if __name__ == '__main__': 56 if __name__ == '__main__':
52 main() 57 main()
OLDNEW
« no previous file with comments | « tools/metrics/histograms/find_unmapped_histograms.py ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698