diff options
author | chai <chaifix@163.com> | 2021-01-25 14:28:30 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2021-01-25 14:28:30 +0800 |
commit | 6eb915c129fc90c6f4c82ae097dd6ffad5239efc (patch) | |
tree | 7dd2be50edf41f36b60fac84696e731c13afe617 /Client/Assets/Scripts/XMainClient/XTimeProfiler.cs |
+scripts
Diffstat (limited to 'Client/Assets/Scripts/XMainClient/XTimeProfiler.cs')
-rw-r--r-- | Client/Assets/Scripts/XMainClient/XTimeProfiler.cs | 53 |
1 files changed, 53 insertions, 0 deletions
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()
+ {
+ }
+ }
+}
|