v8/tools/gc-nvp-to-csv.py
Michael Achenbach 6ea78398aa [infra] Change all Python shebangs to Python3
The infrastructure runs everything already in Python3, so this is
mostly a clean-up.

For MB, a python2 holdover was removed and new lint errors were
fixed.

The renames were automated with:
git grep -e "/usr/bin/python$" |
  cut -d':' -f1 |
  xargs
  sed -i 's/#!\/usr\/bin\/python$/#!\/usr\/bin\/python3/1'

and
git grep -e "/usr/bin/env python$" |
  cut -d':' -f1 |
  xargs
  sed -i 's/#!\/usr\/bin\/env python$/#!\/usr\/bin\/env python3/1'

Bug: v8:13148
Change-Id: If4f3c7635e72fa134798d55314ac1aa92ddd01bf
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3811499
Reviewed-by: Liviu Rau <liviurau@google.com>
Commit-Queue: Michael Achenbach <machenbach@chromium.org>
Cr-Commit-Position: refs/heads/main@{#82231}
2022-08-05 14:55:00 +00:00

36 lines
832 B
Python
Executable File

#!/usr/bin/env python3
#
# Copyright 2015 the V8 project authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
# This is an utility for generating csv files based on GC traces produced by
# V8 when run with flags --trace-gc --trace-gc-nvp.
#
# Usage: gc-nvp-to-csv.py <GC-trace-filename>
#
# for py2/py3 compatibility
from __future__ import print_function
import sys
import gc_nvp_common
def process_trace(filename):
trace = gc_nvp_common.parse_gc_trace(filename)
if len(trace):
keys = trace[0].keys()
print(', '.join(keys))
for entry in trace:
print(', '.join(map(lambda key: str(entry[key]), keys)))
if len(sys.argv) != 2:
print("Usage: %s <GC-trace-filename>" % sys.argv[0])
sys.exit(1)
process_trace(sys.argv[1])