Example #1
0
 public static ulong GetRegisterValue(uint msr, BitRange range)
 {
     uint LowValue = 0; uint HighValue = 0;
     if (Papi.ReadMSR(msr, ref LowValue, ref HighValue))
     {
         ulong Value = (ulong)(((ulong)HighValue << 32) | (ulong)LowValue);
         return Convert.ToUInt64((Value & range.Mask) >> (int)(range.StartBit));
     }
     else
         return 0;
 }
Example #2
0
        public static ulong SetRegisterValue(uint msr, BitRange range, ulong value)
        {
            ulong regValue = GetRegisterValue(msr);
            regValue &= ~range.Mask;
            regValue |= (value << range.StartBit);

            uint LowValue = 0; uint HighValue = 0;
            LowValue = (uint)(regValue & 0xFFFFFFFF);
            HighValue = (uint)((regValue & 0xFFFFFFFF00000000) >> 32);
            if (Papi.WriteMSR(msr, ref LowValue, ref HighValue))
                return ((ulong)HighValue << 32) | LowValue;
            else
                return 0;
        }
Example #3
0
 public static float GetPStateVoltage(uint msr, BitRange range)
 {
     //float fValue = (float)Value * (((float)1) / ((float)Math.Pow(2, 13)));
     uint LowValue = 0;
     uint HighValue = 0;
     if (Papi.ReadMSR(msr, ref LowValue, ref HighValue))
     {
         ulong Value = (ulong)(((ulong)HighValue << 32) | (ulong)LowValue);
         ulong val = Convert.ToUInt64((Value & range.Mask) >> (int)(range.StartBit));
         return (float)val * (((float)1) / ((float)Math.Pow(2, 13)));
     }
     else
     {
         return 0;
     }
 }