/// <summary> /// Detach the profiler from the profiled process. Does nothing if detaching is disabled in the profiler. To check /// whether the detaching is enabled, use <see cref="GetFeatures" /> with <see cref="MeasureFeatures.Detach" /> flag. /// Doesn't throw any errors even if the application is run with profiling disabled. /// </summary> public static void Detach() { var id = Helper.Id; switch (Helper.Platform) { case PlatformId.Linux: if (LinuxHelper.IsLibCoreApiAlreadyLoaded()) { Helper.InvokeCoreApi(() => LibCoreApi.V1_Measure_Detach(id)); } break; case PlatformId.MacOsX: if (MacOsXHelper.IsLibCoreApiAlreadyLoaded()) { Helper.InvokeCoreApi(() => LibCoreApi.V1_Measure_Detach(id)); } break; case PlatformId.Windows: if (WindowsHelper.IsCoreApiDllAlreadyLoaded()) { Helper.InvokeCoreApi(() => CoreApiDll.V1_Measure_Detach(id)); } break; default: throw new PlatformNotSupportedException(); } }