smart-home-engine 1.18.2 → 1.19.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- import{m as O}from"./monaco-langs-Dt8a9eeo.js";import{t as I}from"./index-AuL9VYgt.js";/*!-----------------------------------------------------------------------------
1
+ import{m as O}from"./monaco-langs-Dt8a9eeo.js";import{t as I}from"./index-xdnNresq.js";/*!-----------------------------------------------------------------------------
2
2
  * Copyright (c) Microsoft Corporation. All rights reserved.
3
3
  * Version: 0.52.2(404545bded1df6ffa41ea0af4e8ddb219018c6c1)
4
4
  * Released under the MIT license
@@ -172,7 +172,7 @@
172
172
  }
173
173
  })();
174
174
  </script>
175
- <script type="module" crossorigin src="/assets/index-AuL9VYgt.js"></script>
175
+ <script type="module" crossorigin src="/assets/index-xdnNresq.js"></script>
176
176
  <link rel="modulepreload" crossorigin href="/assets/monaco-langs-Dt8a9eeo.js">
177
177
  <link rel="stylesheet" crossorigin href="/assets/monaco-langs-DyX1CsEw.css">
178
178
  <link rel="stylesheet" crossorigin href="/assets/index-nf1nG74s.css">
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "smart-home-engine",
3
- "version": "1.18.2",
3
+ "version": "1.19.0",
4
4
  "description": "Node.js based script runner for use in MQTT based Smart Home environments",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
package/src/index.js CHANGED
@@ -328,6 +328,23 @@ let _mqttMsgCount = 0;
328
328
  let _mqttMsgTs = Date.now();
329
329
  let _prevCpuUsage = process.cpuUsage();
330
330
 
331
+ // perf_hooks — event loop utilization + delay histogram (always-on, minimal overhead)
332
+ const { PerformanceObserver, monitorEventLoopDelay, performance } = require('perf_hooks');
333
+ let _prevElu = performance.eventLoopUtilization();
334
+ const _elHisto = monitorEventLoopDelay({ resolution: 20 });
335
+ _elHisto.enable();
336
+
337
+ // GC observer — log only significant GC pauses (>=50ms); never spams on normal minor GCs
338
+ const _gcKinds = { 1: 'minor', 2: 'major', 4: 'incremental', 8: 'weaken' };
339
+ new PerformanceObserver((list) => {
340
+ for (const entry of list.getEntries()) {
341
+ if (entry.duration >= 50) {
342
+ const kind = _gcKinds[entry.detail?.kind] ?? 'gc';
343
+ log.warn(`GC ${kind} pause ${Math.round(entry.duration)}ms`);
344
+ }
345
+ }
346
+ }).observe({ type: 'gc', buffered: false });
347
+
331
348
  // Register runtime stats provider for GET /she/status
332
349
  require('./web/server').setStatsProvider(() => {
333
350
  let topics = 0;
@@ -341,6 +358,11 @@ require('./web/server').setStatsProvider(() => {
341
358
  const cpuDelta = process.cpuUsage(_prevCpuUsage);
342
359
  _prevCpuUsage = process.cpuUsage();
343
360
  const cpuPercent = elapsed > 0 ? Math.round(((cpuDelta.user + cpuDelta.system) / 1000 / (elapsed * 1000)) * 1000) / 10 : 0;
361
+ const eluDelta = performance.eventLoopUtilization(_prevElu);
362
+ _prevElu = performance.eventLoopUtilization();
363
+ const elMeanMs = Math.round(_elHisto.mean / 1e6);
364
+ const elP99Ms = Math.round(_elHisto.percentile(99) / 1e6);
365
+ _elHisto.reset();
344
366
  const mem = process.memoryUsage();
345
367
  const memMb = Math.round(mem.rss / 1048576);
346
368
  const core = shedb.getCore();
@@ -378,6 +400,9 @@ require('./web/server').setStatsProvider(() => {
378
400
  handlers: subscriptions.length + varSubscriptions.length + mqttEventCallbacks.length,
379
401
  memMb,
380
402
  cpuPercent,
403
+ eluPercent: Math.round(eluDelta.utilization * 100),
404
+ elMeanMs,
405
+ elP99Ms,
381
406
  };
382
407
  });
383
408