示例#1
0
        protected Session(string sessionName, DiagnoserActionParameters details, EtwProfilerConfig config, DateTime creationTime)
        {
            Details           = details;
            Config            = config;
            FilePath          = ArtifactFileNameHelper.GetTraceFilePath(details, creationTime, FileExtension).EnsureFolderExists();
            TraceEventSession = new TraceEventSession(sessionName, FilePath)
            {
                BufferSizeMB          = config.BufferSizeInMb,
                CpuSampleIntervalMSec = config.CpuSampleIntervalInMilliseconds,
            };

            Console.CancelKeyPress += OnConsoleCancelKeyPress;
            AppDomain.CurrentDomain.ProcessExit += OnProcessExit;
        }
示例#2
0
        public void Handle(HostSignal signal, DiagnoserActionParameters parameters)
        {
            if (signal != HostSignal.BeforeAnythingElse)
            {
                return;
            }

            var diagnosticsClient = new DiagnosticsClient(parameters.Process.Id);

            EventPipeSession session = diagnosticsClient.StartEventPipeSession(eventPipeProviders, true);

            var fileName = ArtifactFileNameHelper.GetTraceFilePath(parameters, DateTime.Now, "nettrace").EnsureFolderExists();

            benchmarkToTraceFile[parameters.BenchmarkCase] = fileName;

            collectingTask = Task.Run(() => CopyEventStreamToFile(session, fileName, parameters.Config.GetCompositeLogger()));
        }
示例#3
0
        public void OnWindowsWeMustAlwaysUseOldLongPathsLimitForSessionFiles()
        {
            var config = DefaultConfig.Instance
                         .WithArtifactsPath(@"C:\Projects\performance\artifacts\bin\MicroBenchmarks\Release\netcoreapp5.0\BenchmarkDotNet.Artifacts");

            var benchmarkCase = BenchmarkConverter.TypeToBenchmarks(typeof(RentReturnArrayPoolTests <byte>), config).BenchmarksCases.First();

            var parameters = new DiagnoserActionParameters(
                process: null,
                benchmarkCase: benchmarkCase,
                new BenchmarkId(0, benchmarkCase));

            foreach (string fileExtension in new[] { "etl", "kernel.etl", "userheap.etl" })
            {
                var traceFilePath = ArtifactFileNameHelper.GetTraceFilePath(parameters, new System.DateTime(2020, 10, 1), fileExtension);

                Assert.InRange(actual: traceFilePath.Length, low: 0, high: 260);
            }
        }