public IEnumerable <CounterValue> GetValuesBetween(DateTime startTime, DateTime endTime)
        {
            List <CounterValue> res = new List <CounterValue> ();

            lock (values)
            {
                if (values.Count == 0 || startTime > values[values.Count - 1].TimeStamp)
                {
                    return(res);
                }
                for (int n = 0; n < values.Count; n++)
                {
                    CounterValue val = values[n];
                    if (val.TimeStamp > endTime)
                    {
                        break;
                    }
                    if (val.TimeStamp >= startTime)
                    {
                        res.Add(val);
                    }
                }
            }
            return(res);
        }
        internal int StoreValue(string message, TimerTraceList traces)
        {
            DateTime now = DateTime.Now;

            if (resolution.Ticks != 0)
            {
                if (now - lastValueTime < resolution)
                {
                    return(-1);
                }
            }
            var val = new CounterValue(count, totalCount, now, message, traces);

            if (storeValues)
            {
                values.Add(val);
            }
            if (handlers.Count > 0)
            {
                foreach (var h in handlers)
                {
                    h.ConsumeValue(this, val);
                }
            }
            return(values.Count - 1);
        }
Exemplo n.º 3
0
		public TimeLineViewWindow (Counter c, CounterValue value) : base(Gtk.WindowType.Toplevel)
		{
			this.Build ();
			this.mainCounter = c;
			this.mainValue = value;
			timeView.Scale = 300;
			
			Update ();
		}
Exemplo n.º 4
0
 internal void RemoveValue(int index)
 {
     lock (values) {
         values.RemoveAt(index);
         for (int n = index; n < values.Count; n++)
         {
             CounterValue val = values [n];
             val.UpdateValueIndex(n);
         }
     }
 }
Exemplo n.º 5
0
        internal int StoreValue(string?message, ITimeCounter?timer, IDictionary <string, object>?metadata)
        {
            DateTime now = DateTime.Now;

            if (resolution.Ticks != 0)
            {
                if (now - lastValueTime < resolution)
                {
                    return(-1);
                }
                lastValueTime = now;
            }
            var val = new CounterValue(count, totalCount, now, message, timer?.TraceList, metadata);

            if (StoreValues)
            {
                values.Add(val);
            }

            if (Handlers.Count > 0)
            {
                if (timer != null)
                {
                    foreach (var h in handlers)
                    {
                        var t = h.BeginTimer((TimerCounter)this, val);
                        if (t != null)
                        {
                            timer.AddHandlerTracker(t);
                        }
                    }
                }
                else
                {
                    foreach (var h in handlers)
                    {
                        h.ConsumeValue(this, val);
                    }
                }
            }
            return(values.Count - 1);
        }
Exemplo n.º 6
0
        internal int StoreValue(string message, TimeCounter timer)
        {
            DateTime now = DateTime.Now;

            if (resolution.Ticks != 0)
            {
                if (now - lastValueTime < resolution)
                {
                    return(-1);
                }
            }
            var val = new CounterValue(count, totalCount, count - lastStoredCount, now, message, timer != null ? timer.TraceList : null);

            lastStoredCount = count;

            if (storeValues)
            {
                values.Add(val);
            }
            if (Handlers.Count > 0)
            {
                if (timer != null)
                {
                    foreach (var h in handlers)
                    {
                        var t = h.BeginTimer((TimerCounter)this, val);
                        if (t != null)
                        {
                            timer.AddHandlerTracker(t);
                        }
                    }
                }
                else
                {
                    foreach (var h in handlers)
                    {
                        h.ConsumeValue(this, val);
                    }
                }
            }
            return(values.Count - 1);
        }
Exemplo n.º 7
0
        public IEnumerable <CounterValue> GetValuesAfter(DateTime time)
        {
            List <CounterValue> res = new List <CounterValue> ();

            lock (values) {
                for (int n = values.Count - 1; n >= 0; n--)
                {
                    CounterValue val = values [n];
                    if (val.TimeStamp > time)
                    {
                        res.Add(val);
                    }
                    else
                    {
                        break;
                    }
                }
            }
            res.Reverse();
            return(res);
        }
Exemplo n.º 8
0
		internal int StoreValue (string message, TimerTraceList traces)
		{
			DateTime now = DateTime.Now;
			if (resolution.Ticks != 0) {
				if (now - lastValueTime < resolution)
					return -1;
			}
			var val = new CounterValue (count, totalCount, now, message, traces);
			if (storeValues)
				values.Add (val);
			if (handlers.Count > 0) {
				foreach (var h in handlers)
					h.ConsumeValue (this, val);
			}
			return values.Count - 1;
		}
Exemplo n.º 9
0
		public void SetMainCounter (Counter c, CounterValue value)
		{
			mainCounter = c;
			mainValue = value;
			data = null;
			Scale = scale;
			QueueDraw ();
		}
Exemplo n.º 10
0
 public virtual IDisposable?BeginTimer(TimerCounter counter, CounterValue value)
 {
     return(null);
 }
Exemplo n.º 11
0
 public virtual void ConsumeValue(Counter counter, CounterValue value)
 {
 }
		public virtual IDisposable BeginTimer (TimerCounter counter, CounterValue value)
		{
			return null;
		}
		public virtual void ConsumeValue (Counter counter, CounterValue value)
		{
		}
Exemplo n.º 14
0
		internal int StoreValue (string message, TimeCounter timer)
		{
			DateTime now = DateTime.Now;
			if (resolution.Ticks != 0) {
				if (now - lastValueTime < resolution)
					return -1;
			}
			var val = new CounterValue (count, totalCount, count - lastStoredCount, now, message, timer != null ? timer.TraceList : null);
			lastStoredCount = count;

			if (storeValues)
				values.Add (val);
			if (Handlers.Count > 0) {
				if (timer != null) {
					foreach (var h in handlers) {
						var t = h.BeginTimer ((TimerCounter)this, val);
						if (t != null)
							timer.AddHandlerTracker (t);
					}
				} else {
					foreach (var h in handlers)
						h.ConsumeValue (this, val);
				}
			}
			return values.Count - 1;
		}