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

Unified Diff: tracing/bin/valueset2html

Issue 2429223003: Add --html --json args to valueset2html. (Closed)
Patch Set: fixed Created 4 years, 2 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: tracing/bin/valueset2html
diff --git a/tracing/bin/valueset2html b/tracing/bin/valueset2html
index 93a68a776139ca660c6485f5179131bfdde39064..f07b238e83ea2ac10f275ef2baf5daf2882e9708 100755
--- a/tracing/bin/valueset2html
+++ b/tracing/bin/valueset2html
@@ -5,6 +5,7 @@
import argparse
import codecs
+import json
import sys
import os
@@ -21,12 +22,25 @@ def main():
help='HTML file path (output).')
parser.add_argument('-h', '--help', action='help',
help='Show this help message and exit.')
+ parser.add_argument('--html', nargs='+', default=[],
+ help='Zero or more HTML file paths (input).')
+ parser.add_argument('--json', nargs='+', default=[],
+ help='Zero or more JSON file paths (input).')
args = parser.parse_args()
+ histograms = []
+
+ for html_path in args.html:
+ histograms.extend(results_renderer.ReadExistingResults(
+ open(html_path, 'r')))
+
+ for json_path in args.json:
+ histograms.extend(json.load(open(json_path, 'r')))
+
open(args.html_path, 'a').close() # Create file if it doesn't exist.
with codecs.open(args.html_path,
mode='r+', encoding='utf-8') as output_stream:
- results_renderer.RenderHTMLView([], output_stream)
+ results_renderer.RenderHTMLView(histograms, output_stream)
if __name__ == '__main__':
sys.exit(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