Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(81)

Side by Side Diff: tools/gc_nvp_common.py

Issue 1422543005: [tools] Fix regexp grepping for GC NVP float values. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2015 the V8 project authors. All rights reserved. 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 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 # 5 #
6 # Common code for parsing --trace-gc-nvp output. 6 # Common code for parsing --trace-gc-nvp output.
7 # 7 #
8 8
9 9
10 from __future__ import with_statement 10 from __future__ import with_statement
11 import re 11 import re
12 12
13 def split_nvp(s): 13 def split_nvp(s):
14 t = {} 14 t = {}
15 for (name, value) in re.findall(r"(\w+)=([-\w]+)", s): 15 for (name, value) in re.findall(r"(\w+)=([-\w]+(?:\.[0-9]+)?)", s):
16 try: 16 try:
17 t[name] = float(value) 17 t[name] = float(value)
18 except ValueError: 18 except ValueError:
19 t[name] = value 19 t[name] = value
20 20
21 return t 21 return t
22 22
23 23
24 def parse_gc_trace(input): 24 def parse_gc_trace(input):
25 trace = [] 25 trace = []
26 with open(input) as f: 26 with open(input) as f:
27 for line in f: 27 for line in f:
28 info = split_nvp(line) 28 info = split_nvp(line)
29 if info and 'pause' in info and info['pause'] > 0: 29 if info and 'pause' in info and info['pause'] > 0:
30 info['i'] = len(trace) 30 info['i'] = len(trace)
31 trace.append(info) 31 trace.append(info)
32 return trace 32 return trace
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698