Example #1
0
 internal ProfilingData(bool isMultiple, string action, IProfilerLogger logger, Stopwatch stopwatch)
 {
     IsMultiple       = isMultiple;
     Action           = action;
     _parentStopwatch = stopwatch;
     _logger          = logger;
 }
Example #2
0
        /// <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();
        }
        /// <exception cref="ArgumentNullException"><paramref name="profiler"/> is <see langword="null" />.</exception>
        /// <exception cref="ArgumentNullException"><paramref name="logger"/> is <see langword="null" />.</exception>
        public ProfileSession([NotNull] IProfiler profiler,
                              [NotNull] IProfilerLogger logger)
        {
            this.stopwatch = Stopwatch.StartNew();

            this.Profiler = profiler ?? throw new ArgumentNullException(nameof(profiler));
            this.logger   = logger ?? throw new ArgumentNullException(nameof(logger));

            this.operations      = new List <ProfileOperation>();
            this.operationsStack = new AsyncLocal <Stack <ProfileOperation> >();
            this.Data            = new Dictionary <string, object>(StringComparer.Ordinal);
        }
Example #4
0
 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));
 }