mirror of
https://github.com/vladmandic/automatic
synced 2026-08-31 09:31:00 +02:00
4b2f38ab7f
Signed-off-by: Vladimir Mandic <mandic00@live.com>
18 lines
625 B
TypeScript
18 lines
625 B
TypeScript
import { debug } from './logger';
|
|
|
|
export const allTimers: [string, number][] = [];
|
|
|
|
export async function timer(name: string, elapsed: number): Promise<void> {
|
|
allTimers.push([name, Math.round(elapsed)]);
|
|
}
|
|
window.timer = timer;
|
|
|
|
export async function logTimers(): Promise<void> {
|
|
// allTimers.sort((a, b) => b[1] - a[1]);
|
|
const filteredTimers = allTimers.filter((t) => t[1] > 100);
|
|
const objTimers: Record<string, number> = {};
|
|
for (const [name, elapsed] of filteredTimers) objTimers[name] = elapsed;
|
|
debug('startupTimers', objTimers);
|
|
// xhrPost(`${window.api}/log`, { debug: JSON.stringify(objTimers) });
|
|
}
|