• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/usr/bin/env python
2#
3# Copyright 2015 the V8 project authors. All rights reserved.
4# Use of this source code is governed by a BSD-style license that can be
5# found in the LICENSE file.
6
7#
8# This is an utility for generating csv files based on GC traces produced by
9# V8 when run with flags --trace-gc --trace-gc-nvp.
10#
11# Usage: gc-nvp-to-csv.py <GC-trace-filename>
12#
13
14import sys
15import gc_nvp_common
16
17def process_trace(filename):
18  trace = gc_nvp_common.parse_gc_trace(filename)
19  if len(trace):
20    keys = trace[0].keys()
21    print ', '.join(keys)
22    for entry in trace:
23      print ', '.join(map(lambda key: str(entry[key]), keys))
24
25
26if len(sys.argv) != 2:
27  print "Usage: %s <GC-trace-filename>" % sys.argv[0]
28  sys.exit(1)
29
30process_trace(sys.argv[1])
31