コード例 #1
0
ファイル: SchedulerTests.cs プロジェクト: Yetangitu/f-spot
        public void TestSimultaneousSpeedJobs ()
        {
            scheduler = new Scheduler ();
            scheduler.Add (new TestJob (200, PriorityHints.SpeedSensitive, Resource.Cpu, Resource.Disk));
            scheduler.Add (new TestJob (200, PriorityHints.SpeedSensitive, Resource.Cpu, Resource.Disk));
            scheduler.Add (new TestJob (200, PriorityHints.None, Resource.Cpu, Resource.Disk));

            // Test that two SpeedSensitive jobs with the same Resources will run simultaneously
            AssertJobsRunning (2);

            // but that the third that isn't SpeedSensitive won't run until they are both done
            while (scheduler.JobCount > 1);
            Assert.AreEqual (PriorityHints.None, scheduler.Jobs.First ().PriorityHints);
        }
コード例 #2
0
ファイル: SchedulerTests.cs プロジェクト: Yetangitu/f-spot
        public void TestSpeedJobPreemptsNonSpeedJobs ()
        {
            scheduler = new Scheduler ();
            TestJob a = new TestJob (200, PriorityHints.None, Resource.Cpu);
            TestJob b = new TestJob (200, PriorityHints.None, Resource.Disk);
            TestJob c = new TestJob (200, PriorityHints.LongRunning, Resource.Database);
            scheduler.Add (a);
            scheduler.Add (b);
            scheduler.Add (c);

            // Test that three jobs got started
            AssertJobsRunning (3);

            scheduler.Add (new TestJob (200, PriorityHints.SpeedSensitive, Resource.Cpu, Resource.Disk));

            // Make sure the SpeedSensitive jobs has caused the Cpu and Disk jobs to be paused
            AssertJobsRunning (2);
            Assert.AreEqual (true, a.IsScheduled);
            Assert.AreEqual (true, b.IsScheduled);
            Assert.AreEqual (true, c.IsRunning);
        }
コード例 #3
0
ファイル: SchedulerTests.cs プロジェクト: Yetangitu/f-spot
 public void TestOneNonSpeedJobPerResource ()
 {
     // Test that two SpeedSensitive jobs with the same Resources will run simultaneously
     scheduler = new Scheduler ();
     scheduler.Add (new TestJob (200, PriorityHints.None, Resource.Cpu, Resource.Disk));
     scheduler.Add (new TestJob (200, PriorityHints.None, Resource.Cpu, Resource.Disk));
     AssertJobsRunning (1);
 }