public SessionConfiguration(uint circularBufferSizeMB, EventPipeSerializationFormat format, string outputPath, IReadOnlyCollection <Provider> providers) { if (circularBufferSizeMB == 0) { throw new ArgumentException($"Buffer size cannot be zero."); } if (format != EventPipeSerializationFormat.NetPerf && format != EventPipeSerializationFormat.NetTrace) { throw new ArgumentException("Unrecognized format"); } if (providers == null) { throw new ArgumentNullException(nameof(providers)); } if (providers.Count() <= 0) { throw new ArgumentException($"Specified providers collection is empty."); } if (outputPath != null && Directory.Exists(outputPath)) // Make sure the input is not a directory. { throw new ArgumentException($"Specified output file name: {outputPath}, refers to a directory."); } CircularBufferSizeInMB = circularBufferSizeMB; Format = format; string extension = format == EventPipeSerializationFormat.NetPerf ? ".netperf" : ".nettrace"; _outputPath = outputPath != null ? new FileInfo(fileName: !outputPath.EndsWith(extension) ? $"{outputPath}{extension}" : outputPath) : null; _providers = new List <Provider>(providers); }
public SessionConfiguration(uint circularBufferSizeMB, EventPipeSerializationFormat format, IReadOnlyCollection <Provider> providers) { if (circularBufferSizeMB == 0) { throw new ArgumentException($"Buffer size cannot be zero."); } if (format != EventPipeSerializationFormat.NetPerf && format != EventPipeSerializationFormat.NetTrace) { throw new ArgumentException("Unrecognized format"); } if (providers == null) { throw new ArgumentNullException(nameof(providers)); } if (providers.Count() <= 0) { throw new ArgumentException($"Specified providers collection is empty."); } CircularBufferSizeInMB = circularBufferSizeMB; Format = format; string extension = format == EventPipeSerializationFormat.NetPerf ? ".netperf" : ".nettrace"; _providers = new List <Provider>(providers); }
private static unsafe extern ulong Enable( char *outputFile, EventPipeSerializationFormat format, uint circularBufferSizeInMB, EventPipeProviderConfigurationNative *providers, uint numProviders );
internal EventPipeConfiguration( string outputFile, EventPipeSerializationFormat format, uint circularBufferSizeInMB) { if (string.IsNullOrEmpty(outputFile)) { throw new ArgumentNullException(nameof(outputFile)); } if (circularBufferSizeInMB == 0) { throw new ArgumentOutOfRangeException(nameof(circularBufferSizeInMB)); } m_outputFile = outputFile; m_format = format; m_circularBufferSizeInMB = circularBufferSizeInMB; m_providers = new List <EventPipeProviderConfiguration>(); }
public EventPipeSessionConfiguration(int circularBufferSizeMB, EventPipeSerializationFormat format, IEnumerable <EventPipeProvider> providers, bool requestRundown = true) { if (circularBufferSizeMB == 0) { throw new ArgumentException($"Buffer size cannot be zero."); } if (format != EventPipeSerializationFormat.NetPerf && format != EventPipeSerializationFormat.NetTrace) { throw new ArgumentException("Unrecognized format"); } if (providers == null) { throw new ArgumentNullException(nameof(providers)); } CircularBufferSizeInMB = circularBufferSizeMB; Format = format; RequestRundown = requestRundown; _providers = new List <EventPipeProvider>(providers); }
internal static unsafe ulong Enable( string?outputFile, EventPipeSerializationFormat format, uint circularBufferSizeInMB, EventPipeProviderConfiguration[] providers) { Span <EventPipeProviderConfigurationNative> providersNative = new Span <EventPipeProviderConfigurationNative>((void *)Marshal.AllocCoTaskMem(sizeof(EventPipeProviderConfigurationNative) * providers.Length), providers.Length); providersNative.Clear(); try { for (int i = 0; i < providers.Length; i++) { EventPipeProviderConfigurationNative.MarshalToNative(providers[i], ref providersNative[i]); } fixed(char *outputFilePath = outputFile) fixed(EventPipeProviderConfigurationNative * providersNativePointer = providersNative) { return(Enable(outputFilePath, format, circularBufferSizeInMB, providersNativePointer, (uint)providersNative.Length)); } } finally { for (int i = 0; i < providers.Length; i++) { providersNative[i].Release(); } fixed(EventPipeProviderConfigurationNative *providersNativePointer = providersNative) { Marshal.FreeCoTaskMem((IntPtr)providersNativePointer); } } }
internal static extern ulong Enable( string?outputFile, EventPipeSerializationFormat format, uint circularBufferSizeInMB, EventPipeProviderConfiguration[] providers, uint numProviders);
public SessionConfigurationV2(uint circularBufferSizeMB, EventPipeSerializationFormat format, bool requestRundown, IReadOnlyCollection <Provider> providers) : base(circularBufferSizeMB, format, providers) { RequestRundown = requestRundown; }