GeezerVison is showing github.com — src: fix v8::CpuProfiler idle sampling · nodejs/node@8e14135
File tree
Expand file treeCollapse file tree
Open diff view settings
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboardExpand all lines: src/node.cc +9-4Lines changed: 9 additions & 4 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -3567,10 +3567,6 @@ inline void PlatformInit() { |
3567 | 3567 | RegisterSignalHandler(SIGINT, SignalExit, true); |
3568 | 3568 | RegisterSignalHandler(SIGTERM, SignalExit, true); |
3569 | 3569 |
|
3570 | | - // Block SIGPROF signals when sleeping in epoll_wait/kevent/etc. Avoids the |
3571 | | - // performance penalty of frequent EINTR wakeups when the profiler is running. |
3572 | | - uv_loop_configure(uv_default_loop(), UV_LOOP_BLOCK_SIGNAL, SIGPROF); |
3573 | | - |
3574 | 3570 | // Raise the open file descriptor limit. |
3575 | 3571 | struct rlimit lim; |
3576 | 3572 | if (getrlimit(RLIMIT_NOFILE, &lim) == 0 && lim.rlim_cur != lim.rlim_max) { |
@@ -3635,6 +3631,15 @@ void Init(int* argc, |
3635 | 3631 | } |
3636 | 3632 | } |
3637 | 3633 |
|
| 3634 | +#ifdef __POSIX__ |
| 3635 | + // Block SIGPROF signals when sleeping in epoll_wait/kevent/etc. Avoids the |
| 3636 | + // performance penalty of frequent EINTR wakeups when the profiler is running. |
| 3637 | + // Only do this for v8.log profiling, as it breaks v8::CpuProfiler users. |
| 3638 | + if (v8_is_profiling) { |
| 3639 | + uv_loop_configure(uv_default_loop(), UV_LOOP_BLOCK_SIGNAL, SIGPROF); |
| 3640 | + } |
| 3641 | +#endif |
| 3642 | + |
3638 | 3643 | #if defined(NODE_HAVE_I18N_SUPPORT) |
3639 | 3644 | if (icu_data_dir == nullptr) { |
3640 | 3645 | // if the parameter isn't given, use the env variable. |
|