public static void ClearEvent(string name)
 {
     if (IsEnabled)
     {
         OpenEvents.Remove(name);
     }
 }
 public static void EndEvent(string name)
 {
     if (IsEnabled)
     {
         Debug.Assert(OpenEvents.ContainsKey(name), "Trying to end an event that is not open.");
         OpenEvents[name].Dispose();
         OpenEvents.Remove(name);
     }
 }