1
0
mirror of https://gitlab.com/MisterBiggs/brain-quartz.git synced 2025-06-16 17:56:39 +00:00
fl0werpowers 951d1dec24
chore(deps): replace chalk and rimraf with builtin functions (#1879)
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-05-28 10:40:51 +02:00

20 lines
415 B
TypeScript

import pretty from "pretty-time"
import { styleText } from "util"
export class PerfTimer {
evts: { [key: string]: [number, number] }
constructor() {
this.evts = {}
this.addEvent("start")
}
addEvent(evtName: string) {
this.evts[evtName] = process.hrtime()
}
timeSince(evtName?: string): string {
return styleText("yellow", pretty(process.hrtime(this.evts[evtName ?? "start"])))
}
}