Skip to content

Performance Monitor

dvk-performance-monitor provides a compact runtime diagnostics panel for large-screen dashboards. It is designed as a local and development-time tool, but production dashboards can opt in by explicitly rendering the element.

html
<dvk-performance-monitor></dvk-performance-monitor>
<dvk-performance-monitor mode="inline" persist="false"></dvk-performance-monitor>

Diagnostics

The compact summary shows FPS and a 0-100 pressure score. Expanding the panel shows frame history, long tasks, heap usage, DOM inventory, dvk-* hotspots, SVG complexity candidates, Canvas pixel risk, animation counts, and video counts.

The monitor scans document.body by default and skips all dvk-performance-monitor instances. Use target or the targetElement property to scope DOM inventory to a specific dashboard region.

html
<dvk-performance-monitor target="#screen-root"></dvk-performance-monitor>
ts
const monitor = document.querySelector('dvk-performance-monitor')
monitor.targetElement = document.querySelector('#screen-root')

Methods

NameDescription
getSnapshot()Returns the latest JSON-serializable diagnostics snapshot.
refresh()Immediately refreshes DOM, SVG, Canvas, video, and animation inventory.
reset()Clears frame history, long-task windows, pressure contributors, and alert cooldown state.
resetPosition()Restores overlay placement after the panel has been dragged.

Props

NameTypeDefaultNotes
modestringoverlayDisplay mode: overlay or inline.
placementstringbottom-rightOverlay placement: top-left, top-right, bottom-left, or bottom-right. Ignored by built-in inline layout.
enabledbooleantrueStarts or stops sampling while keeping the panel mounted. String values such as enabled="false" are supported.
collapsedbooleanfalseShows only the compact summary when true.
persistbooleanautoPersists collapsed state. Defaults to true in overlay mode and false in inline mode.
persist-keystringdatav-kit-performance-monitor-collapsedlocalStorage key used for collapsed state.
emit-samplesbooleantrueEmits dvk-performance-sample after each sample window.
drag-enabledbooleantrueAllows dragging the overlay panel by its header. Inline mode ignores dragging.
sample-intervalnumber1000Frame and long-task sample interval in milliseconds.
scan-intervalnumber3000DOM, SVG, Canvas, video, and animation scan interval in milliseconds.
targetstringemptyCSS selector for the scan scope. Falls back to document.body.
targetElementElement | nullnullProperty-only scan scope. Takes precedence over target.
danger-thresholdnumber70Pressure threshold that triggers danger tone and alerts.
min-fps-thresholdnumber30FPS threshold used by dvk-performance-alert.
long-task-thresholdnumber200Long-task milliseconds threshold used by dvk-performance-alert.
alert-cooldownnumber10000Minimum milliseconds between alert events.
offsetnumber14Overlay edge offset in CSS pixels.
z-indexnumber2147483000Overlay z-index.

Events

NameDetail
dvk-performance-samplePerformanceMonitorSnapshot
dvk-performance-alertPerformanceMonitorAlertDetail
dvk-collapse-change{ collapsed }
dvk-enabled-change{ enabled }

CSS Variables

NameMeaning
--dvk-performance-monitor-bgPanel background.
--dvk-performance-monitor-colorBase text color.
--dvk-performance-monitor-border-colorPanel and button border color.
--dvk-performance-monitor-muted-colorLabel and muted text color.
--dvk-performance-monitor-ok-colorOK pressure color.
--dvk-performance-monitor-warn-colorWarning pressure color.
--dvk-performance-monitor-danger-colorDanger pressure color.
--dvk-performance-monitor-offsetOverlay edge offset.
--dvk-performance-monitor-z-indexOverlay z-index.

Parts

PartDescription
rootPanel wrapper.
headerRuntime header.
toggleCollapse toggle button.
pressurePressure summary block.
detailsExpanded diagnostics wrapper.
sectionDiagnostics section.
section-titleSection title.
metricMetric row or item.
metric-labelMetric label.
metric-valueMetric value.