StopWatch.cs 528 B

123456789101112131415161718192021222324252627282930313233343536
  1. using System;
  2. using System.Diagnostics;
  3. using UnityEngine;
  4. namespace wf
  5. {
  6. public class StopWatch
  7. {
  8. public StopWatch()
  9. {
  10. this.sw = new Stopwatch();
  11. this.sw.Start();
  12. }
  13. public void Stop(string text)
  14. {
  15. int num = this.Stop();
  16. UnityEngine.Debug.Log(string.Concat(new object[]
  17. {
  18. text,
  19. " : ",
  20. num,
  21. "ms"
  22. }));
  23. }
  24. public int Stop()
  25. {
  26. this.sw.Stop();
  27. long elapsedMilliseconds = this.sw.ElapsedMilliseconds;
  28. return (int)elapsedMilliseconds;
  29. }
  30. private Stopwatch sw;
  31. }
  32. }