From 6eb915c129fc90c6f4c82ae097dd6ffad5239efc Mon Sep 17 00:00:00 2001 From: chai Date: Mon, 25 Jan 2021 14:28:30 +0800 Subject: +scripts --- Client/Assets/Scripts/XMainClient/XTimeProfiler.cs | 53 ++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 Client/Assets/Scripts/XMainClient/XTimeProfiler.cs (limited to 'Client/Assets/Scripts/XMainClient/XTimeProfiler.cs') diff --git a/Client/Assets/Scripts/XMainClient/XTimeProfiler.cs b/Client/Assets/Scripts/XMainClient/XTimeProfiler.cs new file mode 100644 index 00000000..de1faf83 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/XTimeProfiler.cs @@ -0,0 +1,53 @@ +using System; + +namespace XMainClient +{ + internal class XTimeProfiler + { + private int _timeLimit; + + private int _start; + + private XTimeoutHandler _handler; + + private static XTimeProfiler _Instance; + + public static XTimeProfiler getLogProfiler(int timeLimit, string message) + { + bool flag = XTimeProfiler._Instance == null; + if (flag) + { + XTimeoutLogHandler handler = new XTimeoutLogHandler(); + XTimeProfiler._Instance = new XTimeProfiler(timeLimit); + XTimeProfiler._Instance.SetHandler(handler); + } + else + { + XTimeProfiler._Instance._timeLimit = timeLimit; + } + (XTimeProfiler._Instance._handler as XTimeoutLogHandler).Message = message; + return XTimeProfiler._Instance; + } + + public XTimeProfiler(int timeLimit) + { + this._timeLimit = timeLimit; + this._start = 0; + this._handler = null; + } + + public void SetHandler(XTimeoutHandler handler) + { + this._handler = handler; + } + + public void Begin() + { + this._start = Environment.TickCount; + } + + public void End() + { + } + } +} -- cgit v1.1-26-g67d0