コード例 #1
0
        internal static ImmutableHashSet <EventPipeProvider> MapToProviders(EventPipeProfile profile, IReadOnlyCollection <EventPipeProvider> providers)
        {
            var uniqueProviders = ImmutableHashSet.CreateBuilder <EventPipeProvider>(EventPipeProviderEqualityComparer.Instance);

            if (providers != null)
            {
                foreach (var userProvidedProfile in providers)
                {
                    uniqueProviders.Add(userProvidedProfile);
                }
            }

            var selectedProfile = EventPipeProfileMapper.DotNetRuntimeProfiles[profile];

            foreach (var provider in selectedProfile)
            {
                uniqueProviders.Add(provider);
            }

            // mandatory provider to enable Engine events
            uniqueProviders.Add(new EventPipeProvider(EngineEventSource.SourceName, EventLevel.Informational, long.MaxValue));
            return(uniqueProviders.ToImmutable());
        }
コード例 #2
0
        public void MandatorySettingsAreAlwaysEnabled(EventPipeProfile eventPipeProfile)
        {
            var result = EventPipeProfiler.MapToProviders(eventPipeProfile, null);

            Assert.Contains(Mandatory, result);
        }
コード例 #3
0
 /// <summary>
 /// Creates a new instance of EventPipeProfiler
 /// </summary>
 /// <param name="profile">A named pre-defined set of provider configurations that allows common tracing scenarios to be specified succinctly.</param>
 /// <param name="providers">A list of EventPipe providers to be enabled.</param>
 /// <param name="performExtraBenchmarksRun">if set to true, benchmarks will be executed one more time with the profiler attached. If set to false, there will be no extra run but the results will contain overhead. True by default.</param>
 public EventPipeProfiler(EventPipeProfile profile = EventPipeProfile.CpuSampling, IReadOnlyCollection <EventPipeProvider> providers = null, bool performExtraBenchmarksRun = true)
 {
     this.performExtraBenchmarksRun = performExtraBenchmarksRun;
     eventPipeProviders             = MapToProviders(profile, providers);
 }
コード例 #4
0
 public EventPipeProfilerAttribute(EventPipeProfile profile)
 {
     Config = ManualConfig.CreateEmpty().AddDiagnoser(new EventPipeProfiler(profile));
 }