Ejemplo n.º 1
0
        public void StatusTestSet3_Hung_NoAsync()
        {
            DateTime date = DateTime.Now.Date;

            var statusData = new LegacyClientStatusData();

            statusData.ClientName        = "Status Test";
            statusData.SlotType          = SlotType.CPU;
            statusData.ClientTimeOffset  = 0;
            statusData.UtcOffsetIsZero   = false;
            statusData.UtcOffset         = TimeSpan.Zero;
            statusData.AllowRunningAsync = false;

            statusData.CurrentStatus  = SlotStatus.Hung;
            statusData.ReturnedStatus = SlotStatus.RunningNoFrameTimes;

            statusData.UnitRetrievalTime = date.Add(new TimeSpan(12, 0, 0));

            // Client Clock is 4 Hours Behind this machine
            statusData.UnitStartTimeStamp      = new TimeSpan(6, 0, 0);
            statusData.TimeOfLastFrame         = new TimeSpan(7, 50, 0);
            statusData.TimeOfLastUnitStart     = date.Add(new TimeSpan(10, 0, 0));
            statusData.TimeOfLastFrameProgress = date.Add(new TimeSpan(11, 50, 0));

            statusData.FrameTime = 633; // 10 Minutes 33 Seconds
            statusData.BenchmarkAverageFrameTime = new TimeSpan(0, 10, 25);

            statusData.AllowRunningAsync = false;
            Assert.AreEqual(SlotStatus.Hung, LegacyClientStatus.GetSlotStatus(statusData, NullLogger.Instance));
        }
Ejemplo n.º 2
0
        public void LegacyClientStatus_Running_UtcOffset()
        {
            DateTime date = DateTime.Now.Date;

            var statusData = new LegacyClientStatusData();

            statusData.ClientName        = "Status Test";
            statusData.SlotType          = SlotType.CPU;
            statusData.ClientTimeOffset  = 0;
            statusData.UtcOffsetIsZero   = false;
            statusData.UtcOffset         = TimeSpan.FromHours(-6);
            statusData.AllowRunningAsync = false;

            statusData.CurrentStatus  = SlotStatus.Running;
            statusData.ReturnedStatus = SlotStatus.RunningNoFrameTimes;

            statusData.UnitRetrievalTime = date.Add(new TimeSpan(3, 0, 0));

            statusData.UnitStartTimeStamp      = new TimeSpan(7, 55, 0);
            statusData.TimeOfLastFrame         = new TimeSpan(8, 50, 0);
            statusData.TimeOfLastUnitStart     = date.Add(new TimeSpan(8, 0, 0));
            statusData.TimeOfLastFrameProgress = date.Add(new TimeSpan(9, 0, 0));

            statusData.FrameTime = 750;
            statusData.BenchmarkAverageFrameTime = new TimeSpan(0, 12, 35);

            Assert.AreEqual(SlotStatus.Running, LegacyClientStatus.GetSlotStatus(statusData, NullLogger.Instance));
        }
Ejemplo n.º 3
0
        public void StatusTestSet2_Hung_NoAsync()
        {
            DateTime date = DateTime.Now.Date;

            var statusData = new LegacyClientStatusData();

            statusData.ClientName        = "Status Test";
            statusData.SlotType          = SlotType.CPU;
            statusData.ClientTimeOffset  = 0;
            statusData.UtcOffsetIsZero   = false;
            statusData.UtcOffset         = TimeSpan.Zero;
            statusData.AllowRunningAsync = false;

            statusData.CurrentStatus  = SlotStatus.GettingWorkPacket;
            statusData.ReturnedStatus = SlotStatus.RunningNoFrameTimes;

            statusData.UnitRetrievalTime = date.Add(new TimeSpan(3, 0, 0));

            // Client Clock is ~2 Hours Behind this machine
            statusData.UnitStartTimeStamp      = new TimeSpan(0, 55, 0);
            statusData.TimeOfLastFrame         = TimeSpan.Zero;
            statusData.TimeOfLastUnitStart     = date.Add(new TimeSpan(3, 0, 0));
            statusData.TimeOfLastFrameProgress = DateTime.MinValue;

            statusData.FrameTime = 0;
            statusData.BenchmarkAverageFrameTime = new TimeSpan(0, 12, 35);

            statusData.AllowRunningAsync = false;
            Assert.AreEqual(SlotStatus.Hung, LegacyClientStatus.GetSlotStatus(statusData, NullLogger.Instance));
        }