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

Unified Diff: experimental/chrome_speed_metrics/scripts/ct_csv_to_traces.py

Issue 3015613002: Add data processing scripts for chrome-speed-metrics
Patch Set: Created 3 years, 3 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
Index: experimental/chrome_speed_metrics/scripts/ct_csv_to_traces.py
diff --git a/experimental/chrome_speed_metrics/scripts/ct_csv_to_traces.py b/experimental/chrome_speed_metrics/scripts/ct_csv_to_traces.py
new file mode 100644
index 0000000000000000000000000000000000000000..28b9feab67c296f2c40dec28dd920668e076b4bf
--- /dev/null
+++ b/experimental/chrome_speed_metrics/scripts/ct_csv_to_traces.py
@@ -0,0 +1,32 @@
+# Copyright 2016 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.
+
+"""Extracts the urls to trace files from a Cluster Telemetry csv output."""
+
+import csv
+import sys
+
+def CsvToTraces(infile, outfile):
+ traces = []
+ with open(infile) as inf:
+ results = csv.DictReader(inf)
+ for r in results:
+ for t in r['trace'].split(','):
+ traces.append(t)
+
+ with open(outfile, 'w') as outf:
+ for trace in traces:
+ outf.write(trace + '\n')
+
+def main():
+ if len(sys.argv) < 3:
+ print "Usage: {0} <input-file> <output-file>".format(sys.argv[0])
+ return
+
+ input_filename = sys.argv[1]
+ output_filename = sys.argv[2]
+ CsvToTraces(input_filename, output_filename)
+
+if __name__ == "__main__":
+ main()

Powered by Google App Engine
This is Rietveld 408576698