Esempio n. 1
0
        public void testBasics()
        {
            MemoryManager mgr      = new MemoryManager(configuredPoolSize);
            NullCallback  callback = new NullCallback();
            long          poolSize = mgr.getTotalMemoryPool();

            Assert.Equal(configuredPoolSize, poolSize);
            Assert.Equal(1.0, mgr.getAllocationScale(), 5);
            mgr.addWriter("p1", 1000, callback);
            Assert.Equal(1.0, mgr.getAllocationScale(), 5);
            mgr.addWriter("p1", poolSize / 2, callback);
            Assert.Equal(1.0, mgr.getAllocationScale(), 5);
            mgr.addWriter("p2", poolSize / 2, callback);
            Assert.Equal(1.0, mgr.getAllocationScale(), 5);
            mgr.addWriter("p3", poolSize / 2, callback);
            Assert.Equal(0.6666667, mgr.getAllocationScale(), 5);
            mgr.addWriter("p4", poolSize / 2, callback);
            Assert.Equal(0.5, mgr.getAllocationScale(), 6);
            mgr.addWriter("p4", 3 * poolSize / 2, callback);
            Assert.Equal(0.3333333, mgr.getAllocationScale(), 6);
            mgr.removeWriter("p1");
            mgr.removeWriter("p2");
            Assert.Equal(0.5, mgr.getAllocationScale(), 5);
            mgr.removeWriter("p4");
            Assert.Equal(1.0, mgr.getAllocationScale(), 5);
        }
 public void testBasics()
 {
     MemoryManager mgr = new MemoryManager(configuredPoolSize);
     NullCallback callback = new NullCallback();
     long poolSize = mgr.getTotalMemoryPool();
     Assert.Equal(configuredPoolSize, poolSize);
     Assert.Equal(1.0, mgr.getAllocationScale(), 5);
     mgr.addWriter("p1", 1000, callback);
     Assert.Equal(1.0, mgr.getAllocationScale(), 5);
     mgr.addWriter("p1", poolSize / 2, callback);
     Assert.Equal(1.0, mgr.getAllocationScale(), 5);
     mgr.addWriter("p2", poolSize / 2, callback);
     Assert.Equal(1.0, mgr.getAllocationScale(), 5);
     mgr.addWriter("p3", poolSize / 2, callback);
     Assert.Equal(0.6666667, mgr.getAllocationScale(), 5);
     mgr.addWriter("p4", poolSize / 2, callback);
     Assert.Equal(0.5, mgr.getAllocationScale(), 6);
     mgr.addWriter("p4", 3 * poolSize / 2, callback);
     Assert.Equal(0.3333333, mgr.getAllocationScale(), 6);
     mgr.removeWriter("p1");
     mgr.removeWriter("p2");
     Assert.Equal(0.5, mgr.getAllocationScale(), 5);
     mgr.removeWriter("p4");
     Assert.Equal(1.0, mgr.getAllocationScale(), 5);
 }
Esempio n. 3
0
		private void EnableForm()
		{
			if (this.InvokeRequired)
			{
				NullCallback d = new NullCallback(EnableForm);
				this.Invoke(d);
			}
			else
			{
				Cursor = Cursors.Default;
				progressBar1.Visible = false;
				textBox1.Enabled = true;
				button1.Enabled = true;
				button2.Text = "Import";
				button2.Enabled = true;
				button3.Enabled = true;
				groupBox1.Enabled = true;
				groupBox2.Enabled = true;
				treeView1.Enabled = true;
				tabControl1.Enabled = true;
				button7.Enabled = true;
				textBox2.Enabled = true;
				textBox3.Enabled = true;
				textBox4.Enabled = true;
				uxAVSync.Value = 0;
				uxAVSync_Scroll(this, null);
			}
		}
Esempio n. 4
0
		private void DisableCancel()
		{
			if (this.InvokeRequired)
			{
				NullCallback d = new NullCallback(DisableCancel);
				this.Invoke(d);
			}
			else
			{
				button2.Enabled = false;
			}
		}
Esempio n. 5
0
		private void DisableForm()
		{
			if (this.InvokeRequired)
			{
				NullCallback d = new NullCallback(DisableForm);
				this.Invoke(d);
			}
			else
			{
				Cursor = Cursors.WaitCursor;
				progressBar1.Visible = true;
				textBox1.Enabled = false;
				button1.Enabled = false;
				button2.Text = "Cancel";
				button3.Enabled = false;
				groupBox1.Enabled = false;
				groupBox2.Enabled = false;
				treeView1.Enabled = false;
				tabControl1.Enabled = false;
				button7.Enabled = false;
				textBox2.Enabled = false;
				textBox3.Enabled = false;
				textBox4.Enabled = false;
			}
		}