Beispiel #1
0
 public Timer(string name, PerfUtilActual parent) // start timer
 {
     _parent = parent;
     if (_parent._perftimersList != null)
     {
         _startIndex = _parent._perftimersList.Count; // note where we began
         // find outer event, set name as outer:name
         int calldepth = parent._perftimersList[_startIndex - 1].Key.Count(x => x == ':');
         if (parent._perftimersList[_startIndex - 1].Key.EndsWith("%")) // Not L10N
         {
             calldepth--;
         }
         _parent._callstack[calldepth + 1] = _startIndex;
         name = cleanupName(name);                                                         // watch for reserved characters in name
         name = _parent._perftimersList[_parent._callstack[calldepth]].Key + " : " + name; // Not L10N
         // add this timer start event to the parent's list of timer events
         _parent._perftimersList.Add(new KeyValuePair <string, long>(name, DateTime.Now.Ticks));
     }
 }
Beispiel #2
0
 // start timer
 public Timer(string name, PerfUtilActual parent)
 {
     _parent = parent;
     if (_parent._perftimersList != null)
     {
         _startIndex = _parent._perftimersList.Count; // note where we began
         // find outer event, set name as outer:name
         int calldepth = parent._perftimersList[_startIndex - 1].Key.Count(x => x == ':');
         if (parent._perftimersList[_startIndex - 1].Key.EndsWith("%")) // Not L10N
             calldepth--;
         _parent._callstack[calldepth + 1] = _startIndex;
         name = cleanupName(name); // watch for reserved characters in name
         name = _parent._perftimersList[_parent._callstack[calldepth]].Key + " : " + name; // Not L10N
         // add this timer start event to the parent's list of timer events
         _parent._perftimersList.Add(new KeyValuePair<string, long>(name, DateTime.Now.Ticks));
     }
 }