This commit is contained in:
2024-08-06 08:05:43 -07:00
commit 129b64a0fb
232 changed files with 39208 additions and 0 deletions

19
quartz/util/perf.ts Normal file
View File

@ -0,0 +1,19 @@
import chalk from "chalk"
import pretty from "pretty-time"
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 chalk.yellow(pretty(process.hrtime(this.evts[evtName ?? "start"])))
}
}