smart-home-engine 1.18.1 → 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.
- package/dist/web/assets/index-nf1nG74s.css +1 -0
- package/dist/web/assets/{index-D8qyUbwO.js → index-xdnNresq.js} +75 -75
- package/dist/web/assets/{tsMode-CPBwsjiU.js → tsMode-DXWg2fgD.js} +1 -1
- package/dist/web/index.html +2 -2
- package/package.json +1 -1
- package/src/index.js +31 -3
- package/dist/web/assets/index-BvKmwc2a.css +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{m as O}from"./monaco-langs-Dt8a9eeo.js";import{t as I}from"./index-
|
|
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
|
package/dist/web/index.html
CHANGED
|
@@ -172,10 +172,10 @@
|
|
|
172
172
|
}
|
|
173
173
|
})();
|
|
174
174
|
</script>
|
|
175
|
-
<script type="module" crossorigin src="/assets/index-
|
|
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
|
-
<link rel="stylesheet" crossorigin href="/assets/index-
|
|
178
|
+
<link rel="stylesheet" crossorigin href="/assets/index-nf1nG74s.css">
|
|
179
179
|
</head>
|
|
180
180
|
<body>
|
|
181
181
|
<div id="app"></div>
|
package/package.json
CHANGED
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
|
|
|
@@ -1005,12 +1030,14 @@ function runScript(script, name, _origin) {
|
|
|
1005
1030
|
|
|
1006
1031
|
const Sandbox = {
|
|
1007
1032
|
setTimeout: (fn, delay, ...args) => {
|
|
1008
|
-
const
|
|
1033
|
+
const wrapped = args.length ? () => fn(...args) : fn;
|
|
1034
|
+
const id = setTimeout(() => _dispatch(name, wrapped), delay);
|
|
1009
1035
|
_myTimers.add(id);
|
|
1010
1036
|
return id;
|
|
1011
1037
|
},
|
|
1012
1038
|
setInterval: (fn, delay, ...args) => {
|
|
1013
|
-
const
|
|
1039
|
+
const wrapped = args.length ? () => fn(...args) : fn;
|
|
1040
|
+
const id = setInterval(() => _dispatch(name, wrapped), delay);
|
|
1014
1041
|
_myTimers.add(id);
|
|
1015
1042
|
return id;
|
|
1016
1043
|
},
|
|
@@ -1084,7 +1111,8 @@ function runScript(script, name, _origin) {
|
|
|
1084
1111
|
// she.setTimeout / she.clearTimeout — tracked versions for use by stdlib and
|
|
1085
1112
|
// sandbox modules that don't have direct access to the Sandbox context.
|
|
1086
1113
|
she.setTimeout = (fn, delay, ...args) => {
|
|
1087
|
-
const
|
|
1114
|
+
const wrapped = args.length ? () => fn(...args) : fn;
|
|
1115
|
+
const id = setTimeout(() => _dispatch(name, wrapped), delay);
|
|
1088
1116
|
_myTimers.add(id);
|
|
1089
1117
|
return id;
|
|
1090
1118
|
};
|