Пример #1
0
        /// <summary>Ctor. </summary>
        /// <param name="engineURI">engine URI</param>
        /// <param name="specification">specifies statement groups</param>
        public StatementMetricRepository(String engineURI,
                                         MetricsReportingConfig specification)
        {
            _specification = specification;
            int numGroups = specification.StatementGroups.Count + 1; // +1 for default group (remaining stmts)

            _groupMetrics = new StatementMetricArray[numGroups];

            // default group
            _groupMetrics[0] = new StatementMetricArray(engineURI, "group-default", 100, false);

            // initialize all other groups
            int countGroups = 1;

            foreach (var entry in specification.StatementGroups)
            {
                MetricsReportingConfig.StmtGroupMetrics config = entry.Value;

                int initialNumStmts = config.NumStatements;
                if (initialNumStmts < 10)
                {
                    initialNumStmts = 10;
                }
                _groupMetrics[countGroups] = new StatementMetricArray(engineURI, "group-" + countGroups, initialNumStmts,
                                                                      config.IsReportInactive);
                countGroups++;
            }

            _statementGroups = new Dictionary <String, int?>();
        }
Пример #2
0
        /// <summary>Ctor. </summary>
        /// <param name="specification">configuration</param>
        /// <param name="engineUri">engine URI</param>
        public MetricReportingServiceImpl(MetricsReportingConfig specification, String engineUri)
        {
            _specification = specification;
            _engineUri     = engineUri;
            _schedule      = new MetricScheduleService();

            _stmtMetricRepository     = new StatementMetricRepository(engineUri, specification);
            _statementGroupExecutions = new LinkedHashMap <String, MetricExecStatement>();
            _statementMetricHandles   = new Dictionary <String, StatementMetricHandle>();
            StatementOutputHooks      = new CopyOnWriteArraySet <StatementResultListener>();

            if (specification.IsThreading)
            {
                _metricsExecutor = new MetricsExecutorThreaded(engineUri);
            }
            else
            {
                _metricsExecutor = new MetricsExecutorUnthreaded();
            }
        }