Skip to content

Commit c0cc651

Browse files
msilivonik-scclaude
andcommitted
docs: add useLensPerformanceMetrics to README
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent ab2dcce commit c0cc651

1 file changed

Lines changed: 26 additions & 0 deletions

File tree

README.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,32 @@ function Preview() {
8686
}
8787
```
8888

89+
### Performance Metrics
90+
91+
Use `useLensPerformanceMetrics` to monitor lens rendering performance:
92+
93+
```tsx
94+
import { useLensPerformanceMetrics } from "@snap/react-camera-kit";
95+
96+
function PerformanceOverlay() {
97+
const metrics = useLensPerformanceMetrics({ interval: 500 });
98+
99+
if (!metrics) return null;
100+
101+
return (
102+
<div>
103+
<p>FPS: {metrics.avgFps.toFixed(1)}</p>
104+
<p>Frame time: {metrics.lensFrameProcessingTimeMsAvg.toFixed(1)}ms</p>
105+
</div>
106+
);
107+
}
108+
```
109+
110+
The hook accepts:
111+
112+
- `interval` (required) — polling interval in milliseconds
113+
- `enabled` (optional, defaults to `true`) — set to `false` to disable measurement without unmounting
114+
89115
## Development
90116

91117
```bash

0 commit comments

Comments
 (0)