blob: 382d87d1e3db74522a085b6c931f03c5d48ef240 [file] [log] [blame]
#! /usr/bin/python
# Copyright 2015 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.
"""Convert trace output for Chrome.
Takes a loading trace from 'analyze.py log_requests' and outputs a zip'd json
that can be loaded by chrome's about:tracing..
"""
import argparse
import gzip
import json
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument('input')
parser.add_argument('output')
args = parser.parse_args()
with gzip.GzipFile(args.output, 'w') as output_f, file(args.input) as input_f:
events = json.load(input_f)['tracing_track']['events']
json.dump({'traceEvents': events, 'metadata': {}}, output_f)