Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 # Copyright 2015 the V8 project 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 # | |
| 6 # Common code for parsing gc-nvp output. | |
|
Hannes Payer (out of office)
2015/06/18 20:57:56
--trace-gc-nvp
rmcilroy
2015/06/19 09:24:23
Done.
| |
| 7 # | |
| 8 | |
| 9 | |
| 10 from __future__ import with_statement | |
| 11 import re | |
| 12 | |
| 13 def split_nvp(s): | |
| 14 t = {} | |
| 15 for (name, value) in re.findall(r"(\w+)=([-\w]+)", s): | |
| 16 try: | |
| 17 t[name] = float(value) | |
| 18 except ValueError: | |
| 19 t[name] = value | |
| 20 | |
| 21 return t | |
| 22 | |
| 23 | |
| 24 def parse_gc_trace(input): | |
| 25 trace = [] | |
| 26 with open(input) as f: | |
| 27 for line in f: | |
| 28 info = split_nvp(line) | |
| 29 if info and 'pause' in info and info['pause'] > 0: | |
| 30 info['i'] = len(trace) | |
| 31 trace.append(info) | |
| 32 return trace | |
| OLD | NEW |