Haiyang-Sun / nodeprof.js

Instrumentation framework for Node.js compliant to ECMAScript 2020 based on GraalVM.
Apache License 2.0
53 stars 22 forks source link

Propagate signals to analysis #39

Closed mtorp closed 5 years ago

mtorp commented 5 years ago

Would it be possible to propagate signals sent to the running NodeProf/Graal to the NodeProf analysis.

For example, I would like to have the endExecution hook fire whenever I press ctrl-C.

process.on('SIGINT', () => {J$.analysis.endExecution()});
alexjordan commented 5 years ago

That handler should already be in place if you use jalangi.js.

https://github.com/Haiyang-Sun/nodeprof.js/blob/master/src/ch.usi.inf.nodeprof/js/jalangi.js#L187:

process.on('SIGINT', function(){
  process.exit();
});

process.on('exit', function () { J$.endExecution(); });
mtorp commented 5 years ago

Thanks. The 'exit' handler does seem to work, but the analysis responds quite slowly to interrupts. In our case it takes almost 30 seconds before the handler is executed.