public static void StartRecord(string timerId, int type) { if (!_isStart) { return; } if (_timerStartIdRecords.Contains(timerId)) { CatDebug.CWarning("StartRecord :Repeat timerID = " + timerId, CatLogType.CatTimer); return; } if (string.IsNullOrEmpty(timerId)) { CatDebug.CError("StartRecord : Null/Empty timerID.", CatLogType.CatTimer); return; } if (_isShowDetail) { CatDebug.CLog("StartRecord : " + timerId + "," + type, CatLogType.CatTimer); } _lastLineTimerId = timerId; _lastLineTimerType = type; _timerStartIdRecords.Add(timerId); _timerStartTimeRecords.Add(DateTime.Now); }
public static void EndRecord(string timerId) { if (!_isStart) { return; } int index = _timerStartIdRecords.IndexOf(timerId); if (index < 0) { CatDebug.CError("EndRecord : Null timerID = " + timerId, CatLogType.CatTimer); return; } TimeSpan ts = DateTime.Now - _timerStartTimeRecords[index]; _timerStartIdRecords.RemoveAt(index); _timerStartTimeRecords.RemoveAt(index); if (_isShowDetail) { CatDebug.CLog("EndRecord : " + timerId + " Cost " + ts.TotalSeconds, CatLogType.CatTimer); } //_timerEndRecords.Add(timerId, ts.TotalMilliseconds); AddEndRecord(timerId, ts.TotalSeconds); if (timerId.Equals(_lastLineTimerId)) { _lastLineTimerId = string.Empty; } }
public static void ShowDetail(bool isShow) { _isShowDetail = isShow; if (_isShowDetail) { CatDebug.CLog("CatTimer:ShowDetail(" + isShow + ")", CatLogType.CatTimer); } }
public static void Start() { if (_isShowDetail) { CatDebug.CLog("CatTimer:Start()", CatLogType.CatTimer); } _isStart = true; }
/// <summary> /// 同时结束Line计时 /// </summary> public static void Stop() { if (_isShowDetail) { CatDebug.CLog("CatTimer:Stop()", CatLogType.CatTimer); } StopLineRecord(); _isStart = false; }
public static void PrintType(int type) { CatDebug.CLog(GetTypeDetail(type).ToString(), CatLogType.CatTimer); }