Skip to content

Commit 1f0e8dc

Browse files
Matt Loringrvagg
Matt Loring
authored andcommitted
installer: install the tick processor
The tick processor is used to provide readable profiling information from isolate tick logs (produced by a call to node -prof). This patch installs the file at $PREFIX/share/doc/node/tick-processor. PR-URL: #3032 Reviewed-By: Ben Noordhuis <[email protected]>
1 parent 99fd1ec commit 1f0e8dc

File tree

2 files changed

+49
-0
lines changed

2 files changed

+49
-0
lines changed

tools/install.py

+45
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import os
1111
import re
1212
import shutil
13+
import stat
1314
import sys
1415

1516
# set at init time
@@ -126,6 +127,48 @@ def subdir_files(path, dest, action):
126127
for subdir, files in ret.items():
127128
action(files, subdir + '/')
128129

130+
def build_tick_processor(action):
131+
tmp_script = 'out/Release/tick-processor'
132+
if action == install:
133+
# construct script
134+
scripts = [
135+
'tools/v8-prof/polyfill.js',
136+
'deps/v8/tools/splaytree.js',
137+
'deps/v8/tools/codemap.js',
138+
'deps/v8/tools/csvparser.js',
139+
'deps/v8/tools/consarray.js',
140+
'deps/v8/tools/csvparser.js',
141+
'deps/v8/tools/consarray.js',
142+
'deps/v8/tools/profile.js',
143+
'deps/v8/tools/profile_view.js',
144+
'deps/v8/tools/logreader.js',
145+
'deps/v8/tools/tickprocessor.js',
146+
'deps/v8/tools/SourceMap.js',
147+
'deps/v8/tools/tickprocessor-driver.js']
148+
args = []
149+
if sys.platform == 'win32':
150+
args.append('--windows')
151+
elif sys.platform == 'darwin':
152+
args.append('--nm=' + abspath(install_path, 'share/doc/node') + '/mac-nm')
153+
args.append('--mac')
154+
with open(tmp_script, 'w') as out_file:
155+
# Add #! line to run with node
156+
out_file.write('#! ' + abspath(install_path, 'bin/node') + '\n')
157+
# inject arguments
158+
for arg in args:
159+
out_file.write('process.argv.splice(2, 0, \'' + arg + '\');\n')
160+
# cat in source files
161+
for script in scripts:
162+
with open(script) as in_file:
163+
shutil.copyfileobj(in_file, out_file)
164+
# make executable
165+
st = os.stat(tmp_script)
166+
os.chmod(tmp_script, st.st_mode | stat.S_IEXEC)
167+
# perform installations
168+
action([tmp_script], 'share/doc/node/')
169+
if sys.platform == 'darwin':
170+
action(['deps/v8/tools/mac-nm'], 'share/doc/node/')
171+
129172
def files(action):
130173
is_windows = sys.platform == 'win32'
131174

@@ -140,6 +183,8 @@ def files(action):
140183

141184
action(['deps/v8/tools/gdbinit'], 'share/doc/node/')
142185

186+
build_tick_processor(action)
187+
143188
if 'freebsd' in sys.platform or 'openbsd' in sys.platform:
144189
action(['doc/node.1'], 'man/man1/')
145190
else:

tools/rpm/node.spec

+4
Original file line numberDiff line numberDiff line change
@@ -94,13 +94,17 @@ done
9494
/usr/include/*
9595
/usr/lib/node_modules/
9696
/usr/share/doc/node/gdbinit
97+
/usr/share/doc/node/tick-processor
9798
/usr/share/man/man1/node.1.gz
9899
/usr/share/systemtap/tapset/node.stp
99100
%{_datadir}/%{name}/
100101
%doc CHANGELOG.md LICENSE README.md
101102

102103

103104
%changelog
105+
* Tue Sep 22 2015 Matt Loring <[email protected]>
106+
- Added tick processor.
107+
104108
* Tue Jul 7 2015 Ali Ijaz Sheikh <[email protected]>
105109
- Added gdbinit.
106110

0 commit comments

Comments
 (0)