* `uint circularBufferMB`: The size of the circular buffer used for buffering event data while streaming
* `uint format`: 0 for the legacy NetPerf format and 1 for the NetTrace format
-* `string outputPath`: currently unused, and should be 0 length
* `array<provider_config> providers`: The providers to turn on for the streaming session
A `provider_config` is composed of the following data:
Payload
{
uint circularBufferMB,
- string outputPath,
+ uint format,
array<provider_config> providers
}
public struct SessionConfiguration
{
- public SessionConfiguration(uint circularBufferSizeMB, EventPipeSerializationFormat format, string outputPath, IReadOnlyCollection<Provider> providers)
+ public SessionConfiguration(uint circularBufferSizeMB, EventPipeSerializationFormat format, IReadOnlyCollection<Provider> providers)
{
if (circularBufferSizeMB == 0)
throw new ArgumentException($"Buffer size cannot be zero.");
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 uint CircularBufferSizeInMB { get; }
public EventPipeSerializationFormat Format { get; }
- public string OutputPath => _outputPath?.FullName;
public IReadOnlyCollection<Provider> Providers => _providers.AsReadOnly();
- private readonly FileInfo _outputPath;
private readonly List<Provider> _providers;
public byte[] Serialize()
{
writer.Write(CircularBufferSizeInMB);
writer.Write((uint)Format);
- writer.WriteString(OutputPath);
writer.Write(Providers.Count());
foreach (var provider in Providers)
var configuration = new SessionConfiguration(
circularBufferSizeMB: 1000,
format: EventPipeSerializationFormat.NetTrace,
- outputPath: "",
providers: Trace.Extensions.ToProviders(providerString));
var binaryReader = EventPipeClient.CollectTracing(_processId, configuration, out _sessionId);
var configuration = new SessionConfiguration(
circularBufferSizeMB: buffersize,
format: EventPipeSerializationFormat.NetTrace,
- outputPath: null, // Not used on the streaming scenario.
providers: providerCollection);
var shouldExit = new ManualResetEvent(false);