Пример #1
0
        public float GetPackagePower()
        {
            uint eax_start = 0, eax_stop = 0, edx = 0;
            long t_start, t_stop, f;

            do
            {
                _ols.Rdmsr(0x611, ref eax_start, ref edx);
                t_start = Stopwatch.GetTimestamp();
                f       = Stopwatch.Frequency;
                Thread.Sleep(30);
                _ols.Rdmsr(0x611, ref eax_stop, ref edx);
                t_stop = Stopwatch.GetTimestamp();
            } while (eax_start > eax_stop);
            return(ESU * (eax_stop - eax_start) / (t_stop - t_start) * f);
        }
Пример #2
0
        public bool GetVolta(Peripheral p, out int Volta)
        {
            uint eax = 0;
            uint edx = RDBase + (uint)p * 0x100;

            if (_ols.Wrmsr(0x150, eax, edx) > 0 && _ols.Rdmsr(0x150, ref eax, ref edx) > 0)
            {
                Volta = (int)Math.Round((((int)eax >> 21) / 1.024));
                return(true);
            }
            else
            {
                Volta           = 0;
                Support[(int)p] = false;
                return(false);
            }
        }
Пример #3
0
 public PackageMonitor(Ols ols, string manufacturer)
 {
     Manufacturer = manufacturer;
     if (Manufacturer == "GenuineIntel")
     {
         _ols = ols;
         uint edx = 0, eax = 0;
         if (_ols.Rdmsr(0x606, ref eax, ref edx) > 0)
         {
             PU             = 1F / (float)Math.Pow(2, CPUinfo.BitsSlicer(eax, 3, 0));
             ESU            = 1F / (float)Math.Pow(2, CPUinfo.BitsSlicer(eax, 12, 8));
             TU             = 1F / (float)Math.Pow(2, CPUinfo.BitsSlicer(eax, 19, 16));
             RAPL_supported = true;
         }
         RAPL_supported = true;
     }
     else
     {
         RAPL_supported = false;
     }
 }