internal ProfilingState(int profilingId, ProfilingKey profilingKey, bool isEnabled) { ProfilingId = profilingId; ProfilingKey = profilingKey; this.isEnabled = isEnabled; DisposeDelegate = null; attributes = null; beginText = null; startTime = 0; eventType = ProfilingEventType.CpuProfilingEvent; }
/// <summary> /// Retrieve the selected type of events and returns the number of elapsed frames. /// </summary> /// <param name="eventType">The type of events to retrieve</param> /// <param name="clearOtherEventTypes">if true, also clears the event types to avoid event over-accumulation.</param> /// <returns></returns> public static FastList <ProfilingEvent> GetEvents(ProfilingEventType eventType, bool clearOtherEventTypes = true) { lock (Locker) { var returnValue = eventType == ProfilingEventType.CpuProfilingEvent ? cpuEvents.GetBuffer() : gpuEvents.GetBuffer(); if (eventType == ProfilingEventType.CpuProfilingEvent || clearOtherEventTypes) { cpuEvents.MoveToNextBuffer(); } if (eventType == ProfilingEventType.GpuProfilingEvent || clearOtherEventTypes) { gpuEvents.MoveToNextBuffer(); } return(returnValue); } }
public static void ProcessEvent(ref ProfilingEvent profilingEvent, ProfilingEventType eventType) { // Add event lock (Locker) { var list = eventType == ProfilingEventType.CpuProfilingEvent ? cpuEvents.GetBuffer() : gpuEvents.GetBuffer(); list.Add(profilingEvent); } // Log it if ((profilingEvent.Key.Flags & ProfilingKeyFlags.Log) != 0) { Logger.Log(new ProfilingMessage(profilingEvent.Id, profilingEvent.Key, profilingEvent.Type) { Attributes = profilingEvent.Attributes, ElapsedTime = new TimeSpan((profilingEvent.ElapsedTime * 10000000) / Stopwatch.Frequency), Text = profilingEvent.Text }); } }
internal void Begin(long timeStamp) { eventType = ProfilingEventType.GpuProfilingEvent; EmitEvent(ProfilingMessageType.Begin, null, timeStamp); }