-
Notifications
You must be signed in to change notification settings - Fork 29.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tools: add --prof-process flag to node binary
This change cleans up outstanding comments on #3032. It improves error handling when no isolate file is provided and adds the --prof-process flag to the node binary which executes the tick processor on the provided isolate file. PR-URL: #4021 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Evan Lucas <evanlucas@me.com>
- Loading branch information
1 parent
a04721d
commit 49440b7
Showing
12 changed files
with
88 additions
and
107 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
lib/internal/v8_prof_polyfill.js | ||
lib/punycode.js | ||
test/addons/doc-*/ | ||
test/fixtures | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
'use strict'; | ||
var cp = require('child_process'); | ||
var fs = require('fs'); | ||
var path = require('path'); | ||
|
||
var scriptFiles = [ | ||
'internal/v8_prof_polyfill', | ||
'v8/tools/splaytree', | ||
'v8/tools/codemap', | ||
'v8/tools/csvparser', | ||
'v8/tools/consarray', | ||
'v8/tools/profile', | ||
'v8/tools/profile_view', | ||
'v8/tools/logreader', | ||
'v8/tools/tickprocessor', | ||
'v8/tools/SourceMap', | ||
'v8/tools/tickprocessor-driver' | ||
]; | ||
var tempScript = 'tick-processor-tmp-' + process.pid; | ||
var tempNm = 'mac-nm-' + process.pid; | ||
|
||
process.on('exit', function() { | ||
try { fs.unlinkSync(tempScript); } catch (e) {} | ||
try { fs.unlinkSync(tempNm); } catch (e) {} | ||
}); | ||
process.on('uncaughtException', function(err) { | ||
try { fs.unlinkSync(tempScript); } catch (e) {} | ||
try { fs.unlinkSync(tempNm); } catch (e) {} | ||
throw err; | ||
}); | ||
|
||
scriptFiles.forEach(function(script) { | ||
fs.appendFileSync(tempScript, process.binding('natives')[script]); | ||
}); | ||
var tickArguments = [tempScript]; | ||
if (process.platform === 'darwin') { | ||
fs.writeFileSync(tempNm, process.binding('natives')['v8/tools/mac-nm'], | ||
{ mode: 0o555 }); | ||
tickArguments.push('--mac', '--nm=' + path.join(process.cwd(), tempNm)); | ||
} else if (process.platform === 'win32') { | ||
tickArguments.push('--windows'); | ||
} | ||
tickArguments.push.apply(tickArguments, process.argv.slice(1)); | ||
cp.spawn(process.execPath, tickArguments, { stdio: 'inherit' }); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
49440b7
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@matthewloring do you think it would be possible for this to imply
--prof
and pass that to v8?49440b7
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've experimented with running the profiler at program exit. It's pretty unreliable / confusing because it ends up profiling the tick processor scripts too and there is no good way to turn off the profiler beforehand.
49440b7
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Having the profiler profile the processing scripts is definitely an issue. It is also possible for multiple tick logs to be generated from the execution of the single script and determining which are relevant after the process exits is difficult.