public MultiLoggedParametersVirtualChannel(IExpression virtualExpression, int virtualParameterId, int[] loggedParametersIds, int loggedParametersFrequencyInMilliHz,
                                                   IParametersSymbolTable symbolTable, ISlowRowStorage <TTime> slowRowStorage, ITimeUtils <TTime> timeUtils)
        {
            m_virtualParameterId = virtualParameterId;
            m_loggedParametersFrequencyInMilliHz = loggedParametersFrequencyInMilliHz;
            m_timeUtils = timeUtils;
            m_coverageCircularBuffer = new CoverageCircularBuffer <TTime>(loggedParametersIds, loggedParametersFrequencyInMilliHz, 30, timeUtils);
            m_context = new MultiValueWithSlowRowExpressionContext <TTime>(slowRowStorage, loggedParametersIds);
            var compiler = new CompileVisitor(m_context, symbolTable, new DefaultCallContext());

            virtualExpression.Accept(compiler);
            m_evaluate = compiler.GetCompiledExpression();

            m_timeZero = timeUtils.Zero();
        }
Example #2
0
        public void SegmentsReadyCallbackTest()
        {
            var b = new CoverageCircularBuffer <long>(new [] { 14, 15, 16 }, 10 * 1000, 10, new MillisTimeUtils());

            var called = false;

            b.AddSamples(1000, 14, new double[] { 14, 14, 14, 14 }, (time, count, segments) =>
            {
                called = true;
            });
            Assert.IsFalse(called);

            called = false;
            b.AddSamples(1030, 15, new double[] { 15, 15, 15, 15 }, (time, count, segments) =>
            {
                called = true;
            });
            Assert.IsFalse(called);

            called = false;
            b.AddSamples(1070, 16, new double[] { 16, 16, 16, 16 }, (time, count, segments) =>
            {
                called = true;
                Assert.AreEqual(1070, time);
                Assert.AreEqual(3, count);

                Assert.AreEqual(3, segments.Count);

                for (int i = 0; i < count; ++i)
                {
                    Assert.AreEqual(14, segments[0][i]);
                }

                for (int i = 0; i < count; ++i)
                {
                    Assert.AreEqual(15, segments[1][i]);
                }

                for (int i = 0; i < count; ++i)
                {
                    Assert.AreEqual(16, segments[2][i]);
                }
            });
            Assert.IsTrue(called);
        }