-
Notifications
You must be signed in to change notification settings - Fork 29.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This test is added as it usually crashes without applying the v8 patch: v8/v8@beebee4 PR-URL: #37293 Refs: v8/v8@beebee4 Reviewed-By: Jiawen Geng <[email protected]> Reviewed-By: Juan José Arboleda <[email protected]> Reviewed-By: Richard Lau <[email protected]>
- Loading branch information
1 parent
e446d82
commit 89046d7
Showing
3 changed files
with
45 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#include "node.h" | ||
#include "v8.h" | ||
#include "v8-profiler.h" | ||
|
||
static void StartCpuProfiler(const v8::FunctionCallbackInfo<v8::Value>& args) { | ||
v8::CpuProfiler* profiler = v8::CpuProfiler::New(args.GetIsolate()); | ||
v8::Local<v8::String> profile_title = v8::String::NewFromUtf8( | ||
args.GetIsolate(), | ||
"testing", | ||
v8::NewStringType::kInternalized).ToLocalChecked(); | ||
profiler->StartProfiling(profile_title, true); | ||
} | ||
|
||
NODE_MODULE_INIT(/* exports, module, context */) { | ||
NODE_SET_METHOD(exports, "startCpuProfiler", StartCpuProfiler); | ||
} |
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,9 @@ | ||
{ | ||
'targets': [ | ||
{ | ||
'target_name': 'binding', | ||
'sources': [ 'binding.cc' ], | ||
'includes': ['../common.gypi'], | ||
} | ||
] | ||
} |
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,20 @@ | ||
'use strict'; | ||
|
||
// This test crashes most of the time unless the v8 patch: | ||
// https://github.com/v8/v8/commit/beebee4f80ff2eb91187ef1e8fa00b8ff82a20b3 | ||
// is applied. | ||
const common = require('../../common'); | ||
const bindings = require(`./build/${common.buildType}/binding`); | ||
|
||
function fn() { setImmediate(fn); } | ||
setInterval(function() { | ||
for (let i = 0; i < 1000000; i++) | ||
fn(); | ||
clearInterval(this); | ||
setTimeout(process.reallyExit, 2000); | ||
}, 0); | ||
|
||
|
||
setTimeout(() => { | ||
bindings.startCpuProfiler(); | ||
}, 1000); |