zappyzep/backend/src/utils/easyProfiler.ts

10 lines
286 B
TypeScript
Raw Normal View History

import { Profiler } from "knub/dist/Profiler";
import { performance } from "perf_hooks";
export const startProfiling = (profiler: Profiler, key: string) => {
const startTime = performance.now();
return () => {
profiler.addDataPoint(key, performance.now() - startTime);
};
};