public virtual void SetupStepTimeMetrics(List <IInterceptor> apiAspects, IMetrics metrics)
        {
            var schedulerFactory = new EventScheduler.Factory();
            var timerFactory     = new Timer.Factory();

            var timer = timerFactory.Create();
            var debugEventAggregator =
                new BatchEventAggregator <DebugEventBatch, DebugEventBatchParams,
                                          DebugEventBatchSummary>(_minimumDebugEventBatchSeparationInMillis,
                                                                  schedulerFactory,
                                                                  timer);
            var debugEventRecorder = new DebugEventRecorder(debugEventAggregator, metrics);

            var timeSource = GetTimeSource();
            var metricsCollectionAspect =
                new MetricsCollectionAspect(debugEventRecorder, timeSource);

            apiAspects.Add(metricsCollectionAspect);
        }
        public ExpressionEvaluationRecorder GetExpressionEvaluationRecorder()
        {
            if (_expressionEvaluationRecorder == null)
            {
                var schedulerFactory = new EventScheduler.Factory();
                var timerFactory     = new Timer.Factory();

                ITimer timer = timerFactory.Create();

                var expressionEvaluationEventAggregator =
                    new BatchEventAggregator <ExpressionEvaluationBatch,
                                              ExpressionEvaluationBatchParams, ExpressionEvaluationBatchSummary>(
                        _minimumDebugEventBatchSeparationInMillis, schedulerFactory, timer);

                _expressionEvaluationRecorder =
                    new ExpressionEvaluationRecorder(expressionEvaluationEventAggregator,
                                                     GetDebugSessionMetrics());
            }

            return(_expressionEvaluationRecorder);
        }