Use Smart Profiling to start CPU profiling automatically when the Node event loop stalls.
Simply add a timeout argument to the slc ctl command to specify the threshold; if the event loop stalls for longer than that time, then CPU profiling starts. CPU profiling stops when the event loop resumes execution.
For example, for an application with service ID one (1) running locally:
This command will start CPU profiling for worker process ID 76901 if the event loop on that process stalls for more than 12ms (12 milliseconds). CPU profiling stops when then event loop resumes execution, that is, when it "becomes un-stuck".
Here's an example of smart CPU profiling for an app with service ID one (1) running on a remote host: