Optimize numpy pipeline, add per-stage timing, and auto-sync LED count
- Eliminate 5 numpy↔tuple conversions per frame in processing hot path: map_border_to_leds returns ndarray, inline numpy smoothing with integer math, send_pixels_fast accepts ndarray directly - Fix numpy boolean bug in keepalive check (use `is not None`) - Add per-stage pipeline timing (extract/map/smooth/send) to metrics API and UI with color-coded breakdown bar - Expose device_fps from WLED health check in API schemas - Auto-sync LED count from WLED device: health check detects changes and updates storage, calibration, and active targets automatically - Use integer math for brightness scaling (uint16 * brightness >> 8) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -4669,6 +4669,26 @@ function createTargetCard(target, deviceMap, sourceMap) {
|
||||
<div class="metric-value">${metrics.errors_count || 0}</div>
|
||||
</div>
|
||||
</div>
|
||||
${state.timing_total_ms != null ? `
|
||||
<div class="timing-breakdown">
|
||||
<div class="timing-header">
|
||||
<div class="metric-label">${t('device.metrics.timing')}</div>
|
||||
<div class="timing-total"><strong>${state.timing_total_ms}ms</strong></div>
|
||||
</div>
|
||||
<div class="timing-bar">
|
||||
<span class="timing-seg timing-extract" style="flex:${state.timing_extract_ms}" title="extract ${state.timing_extract_ms}ms"></span>
|
||||
<span class="timing-seg timing-map" style="flex:${state.timing_map_leds_ms}" title="map ${state.timing_map_leds_ms}ms"></span>
|
||||
<span class="timing-seg timing-smooth" style="flex:${state.timing_smooth_ms || 0.1}" title="smooth ${state.timing_smooth_ms}ms"></span>
|
||||
<span class="timing-seg timing-send" style="flex:${state.timing_send_ms}" title="send ${state.timing_send_ms}ms"></span>
|
||||
</div>
|
||||
<div class="timing-legend">
|
||||
<span class="timing-legend-item"><span class="timing-dot timing-extract"></span>extract ${state.timing_extract_ms}ms</span>
|
||||
<span class="timing-legend-item"><span class="timing-dot timing-map"></span>map ${state.timing_map_leds_ms}ms</span>
|
||||
<span class="timing-legend-item"><span class="timing-dot timing-smooth"></span>smooth ${state.timing_smooth_ms}ms</span>
|
||||
<span class="timing-legend-item"><span class="timing-dot timing-send"></span>send ${state.timing_send_ms}ms</span>
|
||||
</div>
|
||||
</div>
|
||||
` : ''}
|
||||
` : ''}
|
||||
</div>
|
||||
<div class="card-actions">
|
||||
|
||||
@@ -150,6 +150,8 @@
|
||||
"device.metrics.frames_skipped": "Skipped",
|
||||
"device.metrics.keepalive": "Keepalive",
|
||||
"device.metrics.errors": "Errors",
|
||||
"device.metrics.timing": "Pipeline timing:",
|
||||
"device.metrics.device_fps": "Device refresh rate",
|
||||
"device.health.online": "Online",
|
||||
"device.health.offline": "Offline",
|
||||
"device.health.checking": "Checking...",
|
||||
|
||||
@@ -150,6 +150,8 @@
|
||||
"device.metrics.frames_skipped": "Пропущено",
|
||||
"device.metrics.keepalive": "Keepalive",
|
||||
"device.metrics.errors": "Ошибки",
|
||||
"device.metrics.timing": "Тайминг пайплайна:",
|
||||
"device.metrics.device_fps": "Частота обновления устройства",
|
||||
"device.health.online": "Онлайн",
|
||||
"device.health.offline": "Недоступен",
|
||||
"device.health.checking": "Проверка...",
|
||||
|
||||
@@ -962,6 +962,71 @@ input:-webkit-autofill:focus {
|
||||
color: #999;
|
||||
}
|
||||
|
||||
/* Timing breakdown bar */
|
||||
.timing-breakdown {
|
||||
margin-top: 8px;
|
||||
padding: 6px 8px;
|
||||
background: var(--bg-color);
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
.timing-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.timing-total {
|
||||
font-size: 0.8rem;
|
||||
color: var(--primary-color);
|
||||
}
|
||||
|
||||
.timing-bar {
|
||||
display: flex;
|
||||
height: 8px;
|
||||
border-radius: 4px;
|
||||
overflow: hidden;
|
||||
margin: 4px 0;
|
||||
gap: 1px;
|
||||
}
|
||||
|
||||
.timing-seg {
|
||||
min-width: 2px;
|
||||
transition: flex 0.3s ease;
|
||||
}
|
||||
|
||||
.timing-extract { background: #4CAF50; }
|
||||
.timing-map { background: #FF9800; }
|
||||
.timing-smooth { background: #2196F3; }
|
||||
.timing-send { background: #E91E63; }
|
||||
|
||||
.timing-legend {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 8px;
|
||||
font-size: 0.75rem;
|
||||
color: #999;
|
||||
margin-top: 4px;
|
||||
}
|
||||
|
||||
.timing-legend-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 3px;
|
||||
}
|
||||
|
||||
.timing-dot {
|
||||
display: inline-block;
|
||||
width: 8px;
|
||||
height: 8px;
|
||||
border-radius: 2px;
|
||||
}
|
||||
|
||||
.timing-dot.timing-extract { background: #4CAF50; }
|
||||
.timing-dot.timing-map { background: #FF9800; }
|
||||
.timing-dot.timing-smooth { background: #2196F3; }
|
||||
.timing-dot.timing-send { background: #E91E63; }
|
||||
|
||||
/* Modal Styles */
|
||||
.modal {
|
||||
display: none;
|
||||
|
||||
Reference in New Issue
Block a user