Exemplo n.º 1
0
        public void ShouldNotAllowOverflowOnSubstraction()
        {
            TimeInterval lower  = TimeInterval.FromMicroseconds(1242);
            TimeInterval higher = TimeInterval.FromMicroseconds(1243);

            Assert.Throws <OverflowException>(() => { var dummy = lower - higher; });
        }
Exemplo n.º 2
0
        public void ShouldReturnCorrectResultFromSubstraction()
        {
            TimeInterval lower  = TimeInterval.FromMicroseconds(1242);
            TimeInterval higher = TimeInterval.FromMicroseconds(1243);

            Assert.AreEqual(TimeInterval.FromMicroseconds(1), higher - lower);
        }
Exemplo n.º 3
0
 public Config()
 {
     Add(
         Job.Dry
         .With(Platform.X64)
         .With(Jit.RyuJit)
         .With(Runtime.Core)
         .WithMinIterationTime(TimeInterval.FromMicroseconds(100))
         .WithLaunchCount(1));
 }
Exemplo n.º 4
0
        public static Threshold Create(ThresholdUnit unit, double value)
        {
            switch (unit)
            {
            case ThresholdUnit.Ratio: return(new RelativeThreshold(value));

            case ThresholdUnit.Nanoseconds: return(new AbsoluteTimeThreshold(TimeInterval.FromNanoseconds(value)));

            case ThresholdUnit.Microseconds: return(new AbsoluteTimeThreshold(TimeInterval.FromMicroseconds(value)));

            case ThresholdUnit.Milliseconds: return(new AbsoluteTimeThreshold(TimeInterval.FromMilliseconds(value)));

            case ThresholdUnit.Seconds: return(new AbsoluteTimeThreshold(TimeInterval.FromSeconds(value)));

            case ThresholdUnit.Minutes: return(new AbsoluteTimeThreshold(TimeInterval.FromMinutes(value)));

            default: throw new ArgumentOutOfRangeException(nameof(unit), unit, null);
            }
        }
 public WelchTTestAbsoluteMicrosecondsAttribute(double threshold)
     : base(BaselineScaledColumn.CreateWelchTTest(new AbsoluteHypothesis(TimeInterval.FromMicroseconds(threshold))))
 {
 }
Exemplo n.º 6
0
        public void ShouldNotAllowOverflowOnAddition()
        {
            TimeInterval value = TimeInterval.FromMicroseconds(1);

            Assert.Throws <OverflowException>(() => { var dummy = TimeInterval.Maximal + value; });
        }
Exemplo n.º 7
0
        private void ScheduleRadioEvents(uint packetLen)
        {
            var timeSource = machine.LocalTimeSource;
            var now        = timeSource.ElapsedVirtualTime;

            // @note  Transmit times assume 1M PHY. Low level BLE firmware
            //        usually takes into account the active phy when calculating
            //        timing delays, so we might need to do that.

            // Bit-counter
            var bcMatchTime      = now + TimeInterval.FromMicroseconds(bitCountCompare.Value);
            var bcMatchTimeStamp = new TimeStamp(bcMatchTime, timeSource.Domain);

            // End event
            var endTime      = now + TimeInterval.FromMicroseconds((uint)(packetLen) * 8);
            var endTimeStamp = new TimeStamp(endTime, timeSource.Domain);

            var disableTime      = endTime + TimeInterval.FromMicroseconds(10);
            var disableTimeStamp = new TimeStamp(disableTime, timeSource.Domain);

            // Address modelled as happening immediatley and serves as anchor
            // point for other events. RIOT triggers IRQ from it.
            SetEvent(Events.Address);

            // RSSI sample period is 0.25 us. Acceptable to model as happening
            // immediatley upon start
            if (shorts.AddressRSSIStart.Value)
            {
                SetEvent(Events.RSSIEnd);
            }

            // Schedule a single bit-counter compare event not eariler than
            // `bitCountCompare` microseconds from now.
            // This is sufficient for BLE with RIOT stack, however it is possible to use bit
            // counter to generate successive events, which this model will not
            // support.
            if (shorts.AddressBitCountStart.Value)
            {
                timeSource.ExecuteInSyncedState(_ =>
                {
                    SetEvent(Events.BitCountMatch);
                }, bcMatchTimeStamp);
            }

            // Schedule "end" events all at once, simulating the transmision time
            // as 8 microseconds-per-byte. Timing distinction between events here doesn't
            // seem important
            timeSource.ExecuteInSyncedState(_ =>
            {
                SetEvent(Events.Payload);
                SetEvent(Events.End);
                SetEvent(Events.CRCOk);
            }, endTimeStamp);

            // BLE stacks use disabled event as common processing trigger.
            timeSource.ExecuteInSyncedState(_ =>
            {
                if (shorts.EndDisable.Value)
                {
                    Disable();
                }
            }, disableTimeStamp);
        }