diff --git a/main.js b/main.js index 3a22ca7..aeb168c 100644 --- a/main.js +++ b/main.js @@ -197,7 +197,15 @@ function _maybeLogEventLoopDelay(activeJobs) { const max = (_eventLoopDelay.max / ns).toFixed(1); const p99 = (_eventLoopDelay.percentile(99) / ns).toFixed(1); const stddev = (_eventLoopDelay.stddev / ns).toFixed(1); - logInfo('perf', `eventloop-delay active=${activeJobs} mean=${mean}ms p99=${p99}ms max=${max}ms stddev=${stddev}ms threadpool=${process.env.UV_THREADPOOL_SIZE}`); + let resStr = ''; + try { + const info = process.getActiveResourcesInfo(); + const hist = {}; + for (const t of info) hist[t] = (hist[t] || 0) + 1; + const top = Object.entries(hist).sort((a, b) => b[1] - a[1]).slice(0, 6).map(([k, v]) => `${k}:${v}`).join(','); + resStr = ` resources=${info.length} {${top}}`; + } catch {} + logInfo('perf', `eventloop-delay active=${activeJobs} mean=${mean}ms p99=${p99}ms max=${max}ms stddev=${stddev}ms threadpool=${process.env.UV_THREADPOOL_SIZE}${resStr}`); _eventLoopDelay.reset(); } catch {} }