Rocky_Mountain_Vending/.pnpm-store/v10/files/a8/93c0c667e9a640ef27c776f078a8f5815fc546ef3d43e638da6eac4641e744f116e2b8989a2754a3439c5f7567ebaa3764d2fbc427b1b3c27aac07539a8568
DMleadgen 46d973904b
Initial commit: Rocky Mountain Vending website
Next.js website for Rocky Mountain Vending company featuring:
- Product catalog with Stripe integration
- Service areas and parts pages
- Admin dashboard with Clerk authentication
- SEO optimized pages with JSON-LD structured data

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-12 16:22:15 -07:00

34 lines
No EOL
1 KiB
Text

import { PerformanceObserver } from 'perf_hooks';
import { warn } from '../../build/output/log';
import { bold } from '../picocolors';
const LONG_RUNNING_GC_THRESHOLD_MS = 15;
const gcEvents = [];
const obs = new PerformanceObserver((list)=>{
const entry = list.getEntries()[0];
gcEvents.push(entry);
if (entry.duration > LONG_RUNNING_GC_THRESHOLD_MS) {
warn(bold(`Long running GC detected: ${entry.duration.toFixed(2)}ms`));
}
});
/**
* Starts recording garbage collection events in the process and warn on long
* running GCs. To disable, call `stopObservingGc`.
*/ export function startObservingGc() {
obs.observe({
entryTypes: [
'gc'
]
});
}
export function stopObservingGc() {
obs.disconnect();
}
/**
* Returns all recorded garbage collection events. This function will only
* return information from when `startObservingGc` was enabled and before
* `stopObservingGc` was called.
*/ export function getGcEvents() {
return gcEvents;
}
//# sourceMappingURL=gc-observer.js.map