summaryrefslogtreecommitdiff
path: root/test/fixtures/workload
diff options
context:
space:
mode:
authorJoyee Cheung <joyeec9h3@gmail.com>2019-04-23 11:47:28 +0800
committerAnna Henningsen <anna@addaleax.net>2019-05-26 22:18:00 +0200
commit4b74dae6b2601ee8be3b16fed48986f1be49f20a (patch)
treed9dde6a3876ade51a6857cf46b242ea59ce9e5ef /test/fixtures/workload
parente2c0c0c68074c539ae2ae30debdeafb9f94d989b (diff)
downloadandroid-node-v8-4b74dae6b2601ee8be3b16fed48986f1be49f20a.tar.gz
android-node-v8-4b74dae6b2601ee8be3b16fed48986f1be49f20a.tar.bz2
android-node-v8-4b74dae6b2601ee8be3b16fed48986f1be49f20a.zip
inspector: implement --heap-prof
In addition implements --heap-prof-name, --heap-prof-dir and --heap-prof-interval. These flags are similar to --cpu-prof flags but they are meant for the V8 sampling heap profiler instead of the CPU profiler. PR-URL: https://github.com/nodejs/node/pull/27596 Fixes: https://github.com/nodejs/node/issues/27421 Reviewed-By: Jan Krems <jan.krems@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
Diffstat (limited to 'test/fixtures/workload')
-rw-r--r--test/fixtures/workload/allocation-exit.js17
-rw-r--r--test/fixtures/workload/allocation-sigint.js17
-rw-r--r--test/fixtures/workload/allocation-worker-argv.js11
-rw-r--r--test/fixtures/workload/allocation-worker.js5
-rw-r--r--test/fixtures/workload/allocation.js16
5 files changed, 66 insertions, 0 deletions
diff --git a/test/fixtures/workload/allocation-exit.js b/test/fixtures/workload/allocation-exit.js
new file mode 100644
index 0000000000..dccc61ac94
--- /dev/null
+++ b/test/fixtures/workload/allocation-exit.js
@@ -0,0 +1,17 @@
+'use strict';
+
+const util = require('util');
+const total = parseInt(process.env.TEST_ALLOCATION) || 100;
+let count = 0;
+let string = '';
+function runAllocation() {
+ string += util.inspect(process.env);
+ if (count++ < total) {
+ setTimeout(runAllocation, 1);
+ } else {
+ console.log(string.length);
+ process.exit(55);
+ }
+}
+
+setTimeout(runAllocation, 1);
diff --git a/test/fixtures/workload/allocation-sigint.js b/test/fixtures/workload/allocation-sigint.js
new file mode 100644
index 0000000000..96ae669016
--- /dev/null
+++ b/test/fixtures/workload/allocation-sigint.js
@@ -0,0 +1,17 @@
+'use strict';
+
+const util = require('util');
+const total = parseInt(process.env.TEST_ALLOCATION) || 100;
+let count = 0;
+let string = '';
+function runAllocation() {
+ string += util.inspect(process.env);
+ if (count++ < total) {
+ setTimeout(runAllocation, 1);
+ } else {
+ console.log(string.length);
+ process.kill(process.pid, "SIGINT");
+ }
+}
+
+setTimeout(runAllocation, 1);
diff --git a/test/fixtures/workload/allocation-worker-argv.js b/test/fixtures/workload/allocation-worker-argv.js
new file mode 100644
index 0000000000..299eb884e5
--- /dev/null
+++ b/test/fixtures/workload/allocation-worker-argv.js
@@ -0,0 +1,11 @@
+'use strict';
+
+const { Worker } = require('worker_threads');
+const path = require('path');
+new Worker(path.join(__dirname, 'allocation.js'), {
+ execArgv: [
+ '--heap-prof',
+ '--heap-prof-interval',
+ process.HEAP_PROF_INTERVAL || '128',
+ ]
+});
diff --git a/test/fixtures/workload/allocation-worker.js b/test/fixtures/workload/allocation-worker.js
new file mode 100644
index 0000000000..21be6ce91a
--- /dev/null
+++ b/test/fixtures/workload/allocation-worker.js
@@ -0,0 +1,5 @@
+'use strict';
+
+const { Worker } = require('worker_threads');
+const path = require('path');
+new Worker(path.join(__dirname, 'allocation.js'));
diff --git a/test/fixtures/workload/allocation.js b/test/fixtures/workload/allocation.js
new file mode 100644
index 0000000000..b9a767f0f5
--- /dev/null
+++ b/test/fixtures/workload/allocation.js
@@ -0,0 +1,16 @@
+'use strict';
+
+const util = require('util');
+const total = parseInt(process.env.TEST_ALLOCATION) || 100;
+let count = 0;
+let string = '';
+function runAllocation() {
+ string += util.inspect(process.env);
+ if (count++ < total) {
+ setTimeout(runAllocation, 1);
+ } else {
+ console.log(string.length);
+ }
+}
+
+setTimeout(runAllocation, 1);