Exemplo n.º 1
0
        public OperationTimer(TimingLevel timingLevel, object target, ITimingStore store)
        {
            Store = store;
            if (!Store.Enabled) return;

            var op = target as IOperation;
            if (op == null) return;
            _timingLevel = timingLevel;
            _type = op.GetType();
            _opaque = op.Opaque;
            _key = op.Key;
            _stopwatch = Stopwatch.StartNew();
        }
 public void EndTimer(TimingLevel level)
 {
     if (_timers != null && _timers.ContainsKey(level))
     {
         IOperationTimer timer;
         if (_timers.TryGetValue(level, out timer))
         {
             if (timer != null)
             {
                 timer.Dispose();
                 _timers.Remove(level);
             }
         }
     }
 }
 public void BeginTimer(TimingLevel level)
 {
     if (Timer != null)
     {
         var timer = Timer(level, this);
         if (_timers == null)
         {
             _timers = new Dictionary <TimingLevel, IOperationTimer>();
         }
         if (!_timers.ContainsKey(level))
         {
             _timers.Add(level, timer);
         }
     }
 }
Exemplo n.º 4
0
 public void BeginTimer(TimingLevel level)
 {
     if (Timer != null)
     {
         var timer = Timer(level, this);
         if (_timers == null)
         {
             _timers = new Dictionary<TimingLevel, IOperationTimer>();
         }
         if (!_timers.ContainsKey(level))
         {
             _timers.Add(level, timer);
         }
     }
 }
Exemplo n.º 5
0
        public OperationTimer(TimingLevel timingLevel, object target, ITimingStore store)
        {
            Store = store;
            if (!Store.Enabled)
            {
                return;
            }

            var op = target as IOperation;

            if (op == null)
            {
                return;
            }
            _timingLevel = timingLevel;
            _type        = op.GetType();
            _opaque      = op.Opaque;
            _key         = op.Key;
            _stopwatch   = Stopwatch.StartNew();
        }
Exemplo n.º 6
0
 public void EndTimer(TimingLevel level)
 {
     if (_timers != null && _timers.ContainsKey(level))
     {
         IOperationTimer timer;
         if(_timers.TryGetValue(level, out timer))
         {
             if (timer != null)
             {
                 timer.Dispose();
                 _timers.Remove(level);
             }
         }
     }
 }