plugin integration round 2

This commit is contained in:
Jacky Zhao committed 2023-05-30 08:02:20 -07:00
1 parent a757521313
commit ad6ce0d73f
29 files changed
+3863 -100

No files matched your search

+19
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'])))
}
}