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

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

Issue 2503283003: Add high-precision timing histograms. (Closed)
Patch Set: Use product name instead of project name. Created 4 years 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 2013 The Chromium Authors. All rights reserved. 2 # Copyright 2013 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 """Pretty-prints the histograms.xml file, alphabetizing tags, wrapping text 6 """Pretty-prints the histograms.xml file, alphabetizing tags, wrapping text
7 at 80 chars, enforcing standard attribute ordering, and standardizing 7 at 80 chars, enforcing standard attribute ordering, and standardizing
8 indentation. 8 indentation.
9 9
10 This is quite a bit more complicated than just calling tree.toprettyxml(); 10 This is quite a bit more complicated than just calling tree.toprettyxml();
(...skipping 14 matching lines...) Expand all
25 import presubmit_util 25 import presubmit_util
26 26
27 import print_style 27 import print_style
28 28
29 29
30 class Error(Exception): 30 class Error(Exception):
31 pass 31 pass
32 32
33 33
34 UNIT_REWRITES = { 34 UNIT_REWRITES = {
35 'microsecond': 'microseconds',
Ilya Sherman 2016/11/29 03:02:48 Please also list "'us': 'microseconds'"
pkalinnikov 2016/11/30 10:13:48 Done.
35 'millisecond': 'ms', 36 'millisecond': 'ms',
36 'milliseconds': 'ms', 37 'milliseconds': 'ms',
37 'kb': 'KB', 38 'kb': 'KB',
38 'kB': 'KB', 39 'kB': 'KB',
39 'kilobytes': 'KB', 40 'kilobytes': 'KB',
40 'kbits/s': 'kbps', 41 'kbits/s': 'kbps',
41 'percent': '%', 42 'percent': '%',
42 'Percent': '%', 43 'Percent': '%',
43 'percentage': '%', 44 'percentage': '%',
44 } 45 }
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 return print_style.GetPrintStyle().PrettyPrintXml(tree) 78 return print_style.GetPrintStyle().PrettyPrintXml(tree)
78 79
79 80
80 def main(): 81 def main():
81 presubmit_util.DoPresubmitMain(sys.argv, 'histograms.xml', 82 presubmit_util.DoPresubmitMain(sys.argv, 'histograms.xml',
82 'histograms.before.pretty-print.xml', 83 'histograms.before.pretty-print.xml',
83 'pretty_print.py', PrettyPrint) 84 'pretty_print.py', PrettyPrint)
84 85
85 if __name__ == '__main__': 86 if __name__ == '__main__':
86 main() 87 main()
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698