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

Side by Side Diff: tools/dump-cpp.py

Issue 2006813002: [prof] Add slide offset in dumpcpp script (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Add unit test for dumpcpp script Created 4 years, 6 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
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright 2016 the V8 project authors. All rights reserved. 2 # Copyright 2016 the V8 project authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 # This script executes dumpcpp.js, collects all dumped C++ symbols, 6 # This script executes dumpcpp.js, collects all dumped C++ symbols,
7 # and merges them back into v8 log. 7 # and merges them back into v8 log.
8 8
9 import os 9 import os
10 import platform 10 import platform
11 import re 11 import re
12 import subprocess 12 import subprocess
13 import sys 13 import sys
14 14
15 def is_file_executable(fPath): 15 def is_file_executable(fPath):
16 return os.path.isfile(fPath) and os.access(fPath, os.X_OK) 16 return os.path.isfile(fPath) and os.access(fPath, os.X_OK)
17 17
18 if __name__ == '__main__': 18 if __name__ == '__main__':
19 JS_FILES = ['splaytree.js', 'codemap.js', 'csvparser.js', 'consarray.js', 19 JS_FILES = ['splaytree.js', 'codemap.js', 'csvparser.js', 'consarray.js',
20 'profile.js', 'logreader.js', 'tickprocessor.js', 'SourceMap.js', 20 'profile.js', 'logreader.js', 'tickprocessor.js', 'SourceMap.js',
21 'dumpcpp.js'] 21 'dumpcpp.js', 'dumpcpp-driver.js']
22 tools_path = os.path.dirname(os.path.realpath(__file__)) 22 tools_path = os.path.dirname(os.path.realpath(__file__))
23 on_windows = platform.system() == 'Windows' 23 on_windows = platform.system() == 'Windows'
24 JS_FILES = [os.path.join(tools_path, f) for f in JS_FILES] 24 JS_FILES = [os.path.join(tools_path, f) for f in JS_FILES]
25 25
26 args = [] 26 args = []
27 log_file = 'v8.log' 27 log_file = 'v8.log'
28 debug = False 28 debug = False
29 for arg in sys.argv[1:]: 29 for arg in sys.argv[1:]:
30 if arg == '--debug': 30 if arg == '--debug':
31 debug = True 31 debug = True
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 if on_windows and out: 65 if on_windows and out:
66 out = re.sub('\r+\n', '\n', out) 66 out = re.sub('\r+\n', '\n', out)
67 67
68 is_written = not bool(out) 68 is_written = not bool(out)
69 with open(log_file, 'w') as f: 69 with open(log_file, 'w') as f:
70 for line in lines: 70 for line in lines:
71 if not is_written and line.startswith('tick'): 71 if not is_written and line.startswith('tick'):
72 f.write(out) 72 f.write(out)
73 is_written = True 73 is_written = True
74 f.write(line) 74 f.write(line)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698