Exemplo n.º 1
0
    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);
    }
Exemplo n.º 2
0
    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;
        }
    }
Exemplo n.º 3
0
 public static void ShowDetail(bool isShow)
 {
     _isShowDetail = isShow;
     if (_isShowDetail)
     {
         CatDebug.CLog("CatTimer:ShowDetail(" + isShow + ")", CatLogType.CatTimer);
     }
 }
Exemplo n.º 4
0
 public static void Start()
 {
     if (_isShowDetail)
     {
         CatDebug.CLog("CatTimer:Start()", CatLogType.CatTimer);
     }
     _isStart = true;
 }
Exemplo n.º 5
0
 /// <summary>
 /// 同时结束Line计时
 /// </summary>
 public static void Stop()
 {
     if (_isShowDetail)
     {
         CatDebug.CLog("CatTimer:Stop()", CatLogType.CatTimer);
     }
     StopLineRecord();
     _isStart = false;
 }
Exemplo n.º 6
0
 public static void PrintType(int type)
 {
     CatDebug.CLog(GetTypeDetail(type).ToString(), CatLogType.CatTimer);
 }