/// <summary> /// Send a <see cref="DiagnosticEvent"/> event to all registered handlers /// </summary> /// <param name="diagnosticEvent">The event to send</param> public static void PostEvent(DiagnosticEvent diagnosticEvent) { if (!s_Initialized) { Initialize(); } if (!ResourceManagerProfilerEventsEnabled) { return; } Debug.Assert(k_UnhandledEvents != null, "DiagnosticEventCollector.PostEvent - s_unhandledEvents == null."); if (s_EventHandlers != null) { s_EventHandlers(diagnosticEvent); } else { k_UnhandledEvents.Add(diagnosticEvent); } if (diagnosticEvent.EventId != "EventCount") { CountFrameEvent(diagnosticEvent.Frame); } }
/// <summary> /// Send a <see cref="DiagnosticEvent"/> event to all registered handlers /// </summary> /// <param name="diagnosticEvent">The event to send</param> public void PostEvent(DiagnosticEvent diagnosticEvent) { if (diagnosticEvent.Stream == (int)ResourceManager.DiagnosticEventType.AsyncOperationCreate && !m_CreatedEvents.ContainsKey(diagnosticEvent.ObjectId)) { m_CreatedEvents.Add(diagnosticEvent.ObjectId, diagnosticEvent); } else if (diagnosticEvent.Stream == (int)ResourceManager.DiagnosticEventType.AsyncOperationDestroy) { m_CreatedEvents.Remove(diagnosticEvent.ObjectId); } Debug.Assert(m_UnhandledEvents != null, "DiagnosticEventCollectorSingleton.PostEvent - s_unhandledEvents == null."); if (s_EventHandlers.Count > 0) { s_EventHandlers.Invoke(diagnosticEvent); } else { m_UnhandledEvents.Add(diagnosticEvent); } }
/// <summary> /// Send a <see cref="DiagnosticEvent"/> event to all registered handlers /// </summary> /// <param name="diagnosticEvent">The event to send</param> public void PostEvent(DiagnosticEvent diagnosticEvent) => DiagnosticEventCollectorSingleton.Instance.PostEvent(diagnosticEvent);