OLD | NEW |
(Empty) | |
| 1 # Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. |
| 4 |
| 5 """Extracts the urls to trace files from a Cluster Telemetry csv output.""" |
| 6 |
| 7 import csv |
| 8 import sys |
| 9 |
| 10 def CsvToTraces(infile, outfile): |
| 11 traces = [] |
| 12 with open(infile) as inf: |
| 13 results = csv.DictReader(inf) |
| 14 for r in results: |
| 15 for t in r['trace'].split(','): |
| 16 traces.append(t) |
| 17 |
| 18 with open(outfile, 'w') as outf: |
| 19 for trace in traces: |
| 20 outf.write(trace + '\n') |
| 21 |
| 22 def main(): |
| 23 if len(sys.argv) < 3: |
| 24 print "Usage: {0} <input-file> <output-file>".format(sys.argv[0]) |
| 25 return |
| 26 |
| 27 input_filename = sys.argv[1] |
| 28 output_filename = sys.argv[2] |
| 29 CsvToTraces(input_filename, output_filename) |
| 30 |
| 31 if __name__ == "__main__": |
| 32 main() |
OLD | NEW |