public virtual void TestMinShares()
 {
     scheds.AddItem(new FakeSchedulable(20));
     scheds.AddItem(new FakeSchedulable(18));
     scheds.AddItem(new FakeSchedulable(0));
     scheds.AddItem(new FakeSchedulable(2));
     ComputeFairShares.ComputeShares(scheds, Resources.CreateResource(40), ResourceType
                                     .Memory);
     VerifyMemoryShares(20, 18, 0, 2);
 }
 public virtual void TestWeightedSharing()
 {
     scheds.AddItem(new FakeSchedulable(0, 2.0));
     scheds.AddItem(new FakeSchedulable(0, 1.0));
     scheds.AddItem(new FakeSchedulable(0, 1.0));
     scheds.AddItem(new FakeSchedulable(0, 0.5));
     ComputeFairShares.ComputeShares(scheds, Resources.CreateResource(45), ResourceType
                                     .Memory);
     VerifyMemoryShares(20, 10, 10, 5);
 }
 public virtual void TestLowMaxShares()
 {
     scheds.AddItem(new FakeSchedulable(0, 100));
     scheds.AddItem(new FakeSchedulable(0, 50));
     scheds.AddItem(new FakeSchedulable(0, 11));
     scheds.AddItem(new FakeSchedulable(0, 3));
     ComputeFairShares.ComputeShares(scheds, Resources.CreateResource(40), ResourceType
                                     .Memory);
     VerifyMemoryShares(13, 13, 11, 3);
 }
 public virtual void TestEqualSharing()
 {
     scheds.AddItem(new FakeSchedulable());
     scheds.AddItem(new FakeSchedulable());
     scheds.AddItem(new FakeSchedulable());
     scheds.AddItem(new FakeSchedulable());
     ComputeFairShares.ComputeShares(scheds, Resources.CreateResource(40), ResourceType
                                     .Memory);
     VerifyMemoryShares(10, 10, 10, 10);
 }
        public virtual void TestLargeShares()
        {
            int million = 1000 * 1000;

            scheds.AddItem(new FakeSchedulable());
            scheds.AddItem(new FakeSchedulable());
            scheds.AddItem(new FakeSchedulable());
            scheds.AddItem(new FakeSchedulable());
            ComputeFairShares.ComputeShares(scheds, Resources.CreateResource(40 * million), ResourceType
                                            .Memory);
            VerifyMemoryShares(10 * million, 10 * million, 10 * million, 10 * million);
        }
 public virtual void TestCPU()
 {
     scheds.AddItem(new FakeSchedulable(Resources.CreateResource(0, 20), new ResourceWeights
                                            (2.0f)));
     scheds.AddItem(new FakeSchedulable(Resources.CreateResource(0, 0), new ResourceWeights
                                            (1.0f)));
     scheds.AddItem(new FakeSchedulable(Resources.CreateResource(0, 5), new ResourceWeights
                                            (1.0f)));
     scheds.AddItem(new FakeSchedulable(Resources.CreateResource(0, 15), new ResourceWeights
                                            (0.5f)));
     ComputeFairShares.ComputeShares(scheds, Resources.CreateResource(0, 45), ResourceType
                                     .Cpu);
     VerifyCPUShares(20, 5, 5, 15);
 }
 public virtual void TestEmptyList()
 {
     ComputeFairShares.ComputeShares(scheds, Resources.CreateResource(40), ResourceType
                                     .Memory);
     VerifyMemoryShares();
 }