Test.ts 684 B

1234567891011121314151617181920212223
  1. import GameLogMgr from "./manage/GameLogMgr";
  2. export default class TestMgr {
  3. private static timeData: Map<string, number> = new Map<string, number>()
  4. public static start(flag: string) {
  5. if (this.timeData.has(flag)) {
  6. GameLogMgr.warn("TestMgr 重复 flag ", flag)
  7. return
  8. }
  9. this.timeData.set(flag, new Date().getTime())
  10. }
  11. public static end(flag: string) {
  12. if (!this.timeData.has(flag)) {
  13. GameLogMgr.warn("flag不存在, 无法计算时差", flag)
  14. return
  15. }
  16. GameLogMgr.log(flag, new Date().getTime() - this.timeData.get(flag))
  17. this.timeData.delete(flag)
  18. }
  19. }