/// <exception cref="ArgumentNullException"><paramref name="configuration"/> is <see langword="null" />.</exception> /// <exception cref="ArgumentNullException"><paramref name="logger"/> is <see langword="null" />.</exception> /// <exception cref="ArgumentNullException"><paramref name="processorService"/> is <see langword="null" />.</exception> public CompletedSessionsProcessorQueue([NotNull] IProfilerConfiguration configuration, [NotNull] IProfilerLogger logger, [NotNull] ICompletedSessionProcessorService processorService) { if (configuration == null) { throw new ArgumentNullException(nameof(configuration)); } if (logger == null) { throw new ArgumentNullException(nameof(logger)); } if (processorService == null) { throw new ArgumentNullException(nameof(processorService)); } this.configuration = configuration; this.processorService = processorService; this.logger = logger; this.dataToProcess = new BlockingCollection <ProfileSession>(this.configuration.ResultsBufferSize); this.cancellationTokenSource = new CancellationTokenSource(); }
public static IProfilerConfiguration UseSerilogTraceWriter(this IProfilerConfiguration settings, Action <ISerilogTraceWriterSettings> configure) { var serilogTraceWriterSettings = new SerilogTraceWriterSettings(); configure(serilogTraceWriterSettings); settings.CreateTraceWriter = () => new SerilogTraceWriter(serilogTraceWriterSettings); return(settings); }
public CustomFactory(IProfilerConfiguration settings) { if (settings == null) { throw new ArgumentNullException(nameof(settings)); } _createTimeMeasure = settings.CreateTimeMeasure ?? (() => new StopwatchTimeMeasure()); _createTraceWriter = settings.CreateTraceWriter ?? (() => DummyTraceWriter.Instance); _createReportWriter = settings.CreateReportWriter ?? (() => DummyReportWriter.Instance); }
public Profiler([NotNull] IProfilerConfiguration configuration, [NotNull] ICurrentSessionProvider currentSession, [NotNull] IProfilerLogger logger, [NotNull] ICompletedSessionsProcessorQueue completedSessionsProcessorQueue, [NotNull] IProfilerEventsHandler eventsHandler) { this.Configuration = configuration ?? throw new ArgumentNullException(nameof(configuration)); this.currentSession = currentSession ?? throw new ArgumentNullException(nameof(currentSession)); this.logger = logger ?? throw new ArgumentNullException(nameof(logger)); this.completedSessionsProcessorQueue = completedSessionsProcessorQueue ?? throw new ArgumentNullException(nameof(completedSessionsProcessorQueue)); this.eventsHandler = eventsHandler ?? throw new ArgumentNullException(nameof(eventsHandler)); }
public CompletedSessionProcessorService([NotNull] IProfilerConfiguration configuration, [NotNull] IProfilerResultsStorage resultsStorage, [NotNull] ICompletedSessionProcessingFilter completedSessionFilter) { if (configuration == null) { throw new ArgumentNullException(nameof(configuration)); } if (resultsStorage == null) { throw new ArgumentNullException(nameof(resultsStorage)); } if (completedSessionFilter == null) { throw new ArgumentNullException(nameof(completedSessionFilter)); } this.configuration = configuration; this.resultsStorage = resultsStorage; this.completedSessionFilter = completedSessionFilter; }
public static IProfilerConfiguration UseInsiderReportWriter(this IProfilerConfiguration settings, IInsider insider) { settings.CreateReportWriter = () => new InsiderReportWriter(insider); return(settings); }
public static IProfiler CreateProfiler(this IProfilerConfiguration settings) { return(new Profiler(new CustomFactory(settings))); }
public static IProfilerConfiguration UseDebugTraceWriter(this IProfilerConfiguration settings) => settings .UseTraceWriter(create: () => DebugTraceWriter.Instance);
public static IProfilerConfiguration UseDummyReportWriter(this IProfilerConfiguration settings) => settings .UseReportWriter(create: () => DummyReportWriter.Instance);
public static IProfilerConfiguration UseStopwatchTimeMeasure(this IProfilerConfiguration settings) => settings .UseTimeMeasure(create: () => new StopwatchTimeMeasure());
public static IProfilerConfiguration UseReportWriter(this IProfilerConfiguration settings, Func <IReportWriter> create) { settings.CreateReportWriter = create; return(settings); }
public static IProfilerConfiguration UseTimeMeasure(this IProfilerConfiguration settings, Func <ITimeMeasure> create) { settings.CreateTimeMeasure = create; return(settings); }
public static IProfilerConfiguration UseConsoleReportWriter(this IProfilerConfiguration settings) => settings .UseReportWriter(create: () => new ConsoleReportWriter());