/* Description: * removes old events, adds in the new events. Called on LateUpdate, after all Update functions have finished. */ public void HandleEvents() { // remove all the events that either don't have a duration or have exceeded their duration. int index = 0; while (index < Events.Count) { ITimedEvent timedEvent = (ITimedEvent)Events[index]; if (timedEvent == null) { Events.RemoveAt(index); } else if ((DateTime.Now - timedEvent.CreationTime).TotalSeconds > timedEvent.Duration) { Events.RemoveAt(index); } else { index++; } } // add in all the new events, clear the new events list Events.AddRange(newEvents); newEvents = new List <IUnityEvent>(); }
public static JaegerLog ToJaegerLog(this ITimedEvent <IEvent> timedEvent) { var tags = timedEvent.Event.Attributes.Select(a => a.ToJaegerTag()).ToList(); tags.Add(new JaegerTag { Key = "description", VType = JaegerTagType.STRING, VStr = timedEvent.Event.Name }); return(new JaegerLog { Timestamp = timedEvent.Timestamp.ToEpochMicroseconds(), Fields = tags, }); }
private static ITimedEvents <T> CreateTimedEvents <T>(TraceEvents <EventWithTime <T> > events, Timer timestampConverter) { if (events == null) { IEnumerable <ITimedEvent <T> > empty = new ITimedEvent <T> [0]; return(TimedEvents <T> .Create(empty, 0)); } var eventsList = new List <ITimedEvent <T> >(events.Events.Count); foreach (EventWithTime <T> networkEvent in events.Events) { eventsList.Add(networkEvent.ToSpanDataTimedEvent(timestampConverter)); } return(TimedEvents <T> .Create(eventsList, events.NumberOfDroppedEvents)); }
private static Span.Types.TimeEvent FromITimeEvent(ITimedEvent <IEvent> source) { return(new Span.Types.TimeEvent { Time = new Timestamp { Nanos = source.Timestamp.Nanos, Seconds = source.Timestamp.Seconds, }, Annotation = new Span.Types.TimeEvent.Types.Annotation { Description = new TruncatableString { Value = source.Event.Name }, Attributes = FromIAttributeMap(source.Event.Attributes), }, }); }
private static Span.Types.TimeEvent FromITimeEvent(ITimedEvent <IMessageEvent> source) { return(new Span.Types.TimeEvent { Time = new Timestamp { Nanos = source.Timestamp.Nanos, Seconds = source.Timestamp.Seconds, }, MessageEvent = new Span.Types.TimeEvent.Types.MessageEvent { Type = source.Event.Type == MessageEventType.Sent ? Span.Types.TimeEvent.Types.MessageEvent.Types.Type.Sent : Span.Types.TimeEvent.Types.MessageEvent.Types.Type.Received, CompressedSize = (ulong)source.Event.CompressedMessageSize, UncompressedSize = (ulong)source.Event.UncompressedMessageSize, Id = (ulong)source.Event.MessageId, }, }); }
public void Remove(ITimedEvent timedEvent) { this.timedEvents.Remove(timedEvent); }
public void Add(ITimedEvent timedEvent) { this.timedEvents.Add(timedEvent); }
public static void RemoveEvent(ITimedEvent timedEvent) { //lock (timedEvents) { timedEvents.Remove(timedEvent); //} }
public static void RemoveEvent(ITimedEvent timedEvent) { //lock (timedEvents) { timedEvents.Remove(timedEvent); //} }
public void Remove(ITimedEvent timedEvent) { timedEvents.Remove(timedEvent); }
public void Add(ITimedEvent timedEvent) { timedEvents.Add(timedEvent); }