예제 #1
0
        private void applyButton_Click(object sender, EventArgs e)
        {
            var controls = new PStateControl[5] {
                p0StateControl, p1StateControl, p2StateControl, nbp0StateControl, nbp1StateControl
            };
            var statuscontrols = new StatusControl[1] {
                statusinfo
            };

            int lastModifiedControl = Array.FindLastIndex(controls, (c) => { return(c.IsModified); });

            if (lastModifiedControl < 0)
            {
                return;                 // no control is modified
            }
            if (lastModifiedControl > 2)
            {
                lastModifiedControl = 2; //checking CPU P-States only -> skip NB P-States
            }
            for (int i = 1; i <= lastModifiedControl; i++)
            {
                // make sure the neighboring P-state on the left specifies a >= VID
                if (controls[i - 1].Vid < controls[i].Vid)
                {
                    MessageBox.Show(string.Format("P{0}'s VID is greater than P{1}'s.", i, i - 1), "Invalid P-state settings", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    tabControl1.SelectedIndex = i;
                    return;
                }
            }

            timer1.Enabled = false;
            timer2.Enabled = false;

            // try to temporarily set the number of boosted (Turbo) P-states to 0
            // this should suspend the restriction of software P-state multis by F3x1F0[MaxSwPstateCpuCof]
            //bool turboEnabled = K10Manager.IsTurboEnabled();
            //int boostedStates = K10Manager.GetNumBoostedStates();
            //if (boostedStates != 0)
            //	K10Manager.SetTurbo(false);

            for (int i = 0; i < 5; i++)
            {
                controls[i].Save();
            }

            //if (turboEnabled)
            //	K10Manager.SetTurbo(true);

            // refresh the P-states
            for (int i = 0; i < 5; i++)
            {
                controls[i].LoadFromHardware(i);
            }

            statuscontrols[0].LoadFromHardware();

            timer1.Enabled = true;
            timer2.Enabled = true;
        }
예제 #2
0
		private void applyButton_Click(object sender, EventArgs e)
		{
			var controls = new PStateControl[5] { p0StateControl, p1StateControl, p2StateControl, nbp0StateControl, nbp1StateControl };
            var statuscontrols = new StatusControl[1] { statusinfo };

			int lastModifiedControl = Array.FindLastIndex(controls, (c) => { return c.IsModified; } );
			if (lastModifiedControl < 0)
				return; // no control is modified

            if (lastModifiedControl > 2)
            {
                lastModifiedControl = 2; //checking CPU P-States only -> skip NB P-States
            }
			for (int i = 1; i <= lastModifiedControl; i++)
			{
				// make sure the neighboring P-state on the left specifies a >= VID
				if (controls[i - 1].Vid < controls[i].Vid)
				{
					MessageBox.Show(string.Format("P{0}'s VID is greater than P{1}'s.", i, i - 1), "Invalid P-state settings", MessageBoxButtons.OK, MessageBoxIcon.Error);
					tabControl1.SelectedIndex = i;
					return;
				}
            }

			timer1.Enabled = false;
            timer2.Enabled = false;

			// try to temporarily set the number of boosted (Turbo) P-states to 0
			// this should suspend the restriction of software P-state multis by F3x1F0[MaxSwPstateCpuCof]
			//bool turboEnabled = K10Manager.IsTurboEnabled();
			//int boostedStates = K10Manager.GetNumBoostedStates();
			//if (boostedStates != 0)
			//	K10Manager.SetTurbo(false);

			for (int i = 0; i < 5; i++)
				controls[i].Save();

			//if (turboEnabled)
			//	K10Manager.SetTurbo(true);

			// refresh the P-states
            for (int i = 0; i < 5; i++)
                controls[i].LoadFromHardware(i);

            statuscontrols[0].LoadFromHardware();

			timer1.Enabled = true;
            timer2.Enabled = true;
		}