コード例 #1
0
        public static bool ReadMSR(uint msr, out ulong value)
        {
            uint LowValue = 0; uint HighValue = 0;
            bool ret = Papi.ReadMSR(msr, ref LowValue, ref HighValue);

            if (ret == true)
            {
                value = (ulong)(((ulong)HighValue << 32) | (ulong)LowValue);
            }
            else
            {
                value = 0;
            }
            return(ret);
        }
コード例 #2
0
        public static bool IsValidPapiVersion(string requiredDllVersion, string requiredDrvVersion, out string dllVersion, out string drvVersion)
        {
            dllVersion = "Unknown";
            drvVersion = "Unknown";

            uint ret = uint.MaxValue;

            try
            {
                ret = Papi.GetPapiVersion(out dllVersion, out drvVersion);
            }
            catch { }

            if (ret == Papi.PAPI_SUCCESS)
            {
                ErrorLog.WriteLine("PAPI DLL Version: " + dllVersion);
                ErrorLog.WriteLine("PAPI DRV Version: " + drvVersion);
            }
            else
            {
                ErrorLog.WriteLine("GetPapiVersion Failed!");
            }

            if (ret != Papi.PAPI_SUCCESS ||
                IsAtLeastRequiredVersion(requiredDllVersion, dllVersion) != true ||
                IsAtLeastRequiredVersion(requiredDrvVersion, drvVersion) != true)
            {
                if (dllVersion == "0.0.0.0" || drvVersion == "0.0.0.0")
                {
                    ErrorLog.WriteLine("Using Debug Version of PAPI! Proceed with Caution!");
                }

                return(false);
            }
            else
            {
                return(true);
            }
        }