1
0
Fork 0
Agora-Miniapp-Tutorial/utils/perf.js

24 lines
367 B
JavaScript
Raw Permalink Normal View History

2022-06-06 11:51:36 +08:00
const Utils = require("./util.js")
class Perf {
constructor() {
this.init();
}
init() {
this.perf = [];
this.ts = new Date().getTime();
}
profile(event) {
const ts = new Date().getTime();
this.perf.push(`${event}: ${ts - this.ts}ms`);
}
dump() {
Utils.log(`${JSON.stringify(this.perf)}`);
}
}
module.exports = new Perf();