Skip to content

Performance Monitor ​

dvk-performance-monitor renders a compact runtime diagnostics panel that is fixed to the bottom-right corner of the viewport. It is a development-time tool: the docs site mounts one globally, so the panel you see in the corner of this page is this component.

html
<dvk-performance-monitor></dvk-performance-monitor>

Diagnostics ​

The header shows the current FPS and a pressure score. Pressure is the sum of two measurements, clamped to 0-100: the share of dropped frames in the last sample window, and the share of that window spent in long tasks. The pressure block turns amber at 38 and red at 70.

Expanding the panel reveals seven rows:

RowMeaning
long tasksCount and total milliseconds reported by the longtask PerformanceObserver.
heapUsed and total JS heap from performance.memory, with the used percentage. Chrome-only; shows n/a elsewhere.
nodesElements found under document.body, including elements inside shadow roots.
dvkElements whose tag name starts with dvk-, excluding dvk-performance-monitor itself.
svg / animSVG elements and their <animate> / <animateTransform> descendants.
videoPlaying videos, and how many of the total are inside the viewport.
canvasCanvas elements.

Samples are collected once per second.

Props ​

NameTypeDefaultNotes
collapsedbooleanfalseShows only the FPS and pressure summary when true. The collapsed state is persisted to localStorage under datav-kit-performance-monitor-collapsed and restored on connect.

Setting the collapsed attribute in markup takes precedence over the persisted state.

CSS Variables ​

NameMeaning
--dvk-performance-monitor-bgPanel background.
--dvk-performance-monitor-colorBase text color.
--dvk-performance-monitor-font-familyPanel font family.
--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-offsetDistance from the viewport edges. Defaults to 14px, or 10px below 640px wide.
--dvk-performance-monitor-z-indexPanel z-index.

Parts ​

PartDescription
rootPanel wrapper.
headerRuntime header.
toggleCollapse toggle button.
pressurePressure summary block.
gridExpanded metrics grid.
metricMetric row.
metric-labelMetric label.
metric-valueMetric value.