예제 #1
0
        private static void Initialize()
        {
            lock (_lock)
            {
                // Try to initialize GLFW
                if (!Glfw.Initialize())
                {
                    throw new InvalidOperationException("Unable to initialize GLFW.");
                }

                // Initializes monitor list and callback
                InitializeMonitors();

                // Initialize graphics adapter
                InitializeGraphicsAdapter();

                // Initialize audio context
                InitializeAudioContext();

                // Determine if transparent framebuffers are possible
                SupportsTransparentFramebuffer = Glfw.GetWindowAttribute(ShareContext, WindowAttribute.TransparentFramebuffer) != 0;

                // Detect hardware information
                CpuInfo = HardwareDetector.DetectCpuInfo();
                GpuInfo = HardwareDetector.DetectGpuInfo();

                //
                Console.WriteLine(CpuInfo);
                Console.WriteLine(GpuInfo);
            }

            // Mark initialization as complete
            IsInitialized = true;
        }
예제 #2
0
 public bool Equals([AllowNull] BenchmarkResults other)
 {
     return(other != null &&
            GpuInfo.Equals(other.GpuInfo) &&
            CpuInfo.Equals(other.CpuInfo) &&
            EqualityComparer <Dictionary <string, float> > .Default.Equals(Scores, other.Scores));
 }
예제 #3
0
 static void AppExitCleanUp(object sender, EventArgs e)
 {
     WmiEventWatcher.StopHpBiosEventWatcher();
     GpuInfo.CloseGpuGroups();
     CpuInfo.CloseCpuGroups();
     Opcode.Close();
     Ring0.Close();
 }
예제 #4
0
        static void Main()
        {
            WmiEventWatcher.StartHpBiosEventWatcher();
            Ring0.Open();
            Opcode.Open();
            GpuInfo.OpenGpuGroups();
            CpuInfo.OpenCpuGroups();

            Application.ApplicationExit += AppExitCleanUp;

            Application.SetHighDpiMode(HighDpiMode.SystemAware);
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new FormMain());
        }
예제 #5
0
        private void UpdateValues(double gpu, double mem, uint duty, double pwr, ref GpuInfo gpuInfo)
        {
            var result = manager.SetFreqDelta(gpu, mem, ref gpuInfo);

            applyResultLabel.Text = "freq:" + result.ToString();

            result = manager.SetCoolerInfo(duty, ref gpuInfo);
            applyResultLabel.Text += " duty:" + result.ToString();

            result = manager.SetPowerLimit(pwr, ref gpuInfo);
            applyResultLabel.Text += " pwr:" + result.ToString();

            // Update input shows apply succeeded value or failed original value
            textBox1.Text = gpuInfo.GpuFreqDelta.ToString();
            textBox2.Text = gpuInfo.MemFreqDelta.ToString();
            textBox3.Text = gpuInfo.CoolerLevels.ToString();
            textBox4.Text = gpuInfo.PowerLimit.ToString();
        }
예제 #6
0
        public static List <GpuInfo> GetGpuInfo()
        {
            var gpuInfos = new List <GpuInfo>();

            try
            {
                ManagementObjectSearcher searcher = new ManagementObjectSearcher("SELECT * FROM Win32_DisplayConfiguration");
                string graphicsCard = string.Empty;
                foreach (ManagementObject obj in searcher.Get())
                {
                    var gpuInfo = new GpuInfo();
                    //foreach (PropertyData property in mo.Properties)
                    //{
                    //    if (property.Name == "Description")
                    //    {
                    //        graphicsCard = property.Value.ToString();
                    //    }
                    //    else
                    //    {
                    //        if (property.Value != null)
                    //        {
                    //            //displayConfiguration.Add(property.Name, property.Value);
                    //        }
                    //    }
                    //}
                    gpuInfo.bitsPerPel           = obj.TryGetProperty("bitsPerPel").ToString();
                    gpuInfo.caption              = obj.TryGetProperty("caption").ToString();
                    gpuInfo.deviceName           = obj.TryGetProperty("deviceName").ToString();
                    gpuInfo.displayFlags         = obj["displayFlags"].ToString();
                    gpuInfo.displayFrequency     = obj["displayFrequency"].ToString();
                    gpuInfo.logPixels            = obj.TryGetProperty("logPixels").ToString();
                    gpuInfo.pelsHeight           = obj.TryGetProperty("pelsHeight").ToString();
                    gpuInfo.pelsWidth            = obj.TryGetProperty("pelsWidth").ToString();
                    gpuInfo.settingID            = obj.TryGetProperty("settingID").ToString();
                    gpuInfo.specificationVersion = obj.TryGetProperty("specificationVersion").ToString();
                    gpuInfos.Add(gpuInfo);
                }
                return(gpuInfos);
            }
            catch (System.Exception ex)
            {
                return(gpuInfos);
            }
        }
예제 #7
0
        /// <summary>
        /// Analyze the system and collect some meta data about it.
        /// This helps with recreating issues or determining problems
        /// later on.
        /// </summary>
        /// <returns>The system info collected</returns>
        public Modules.Logging.SystemInfo GetSystemInfo()
        {
            //First figure out the cpu info
            CpuInfo cpuInfo = new CpuInfo {
                Architecture = Environment.Is64BitOperatingSystem ? "64-Bit" : "32-Bit",
                CoreCount    = Environment.ProcessorCount,
                Model        = UnityEngine.SystemInfo.processorType,
                Frequency    = UnityEngine.SystemInfo.processorFrequency
            };

            GpuInfo gpuInfo = new GpuInfo {
                Make       = UnityEngine.SystemInfo.graphicsDeviceVendor,
                Model      = UnityEngine.SystemInfo.graphicsDeviceName,
                MemorySize = UnityEngine.SystemInfo.graphicsMemorySize
            };

            return(new Modules.Logging.SystemInfo {
                Cpu = cpuInfo,
                Gpu = gpuInfo,
                ComputerName = UnityEngine.SystemInfo.deviceName,
                Model = UnityEngine.SystemInfo.deviceModel,
                OperatingSystem = UnityEngine.SystemInfo.operatingSystem
            });
        }
예제 #8
0
        public Form1()
        {
            var args = Environment.GetCommandLineArgs();

            if (args.Contains("-a") || args.Contains("--auto"))
            {
                isAutoLoad = true;
            }

            InitializeComponent();

            gpuInfoList.Clear();
            gpuInfoListComboBox.Items.Clear();
            manager = GpuManager.Initialization();
            for (uint i = 0; i < manager.GpuCount; i++)
            {
                GpuInfo gpuInfo = null;
                var     result  = manager.GetGpuInformation(i, out gpuInfo);
                if (result == false)
                {
                    continue;
                }
                manager.GetPStateInfo(ref gpuInfo);
                manager.GetFreqDelta(ref gpuInfo);
                manager.GetCoolerInfo(ref gpuInfo);
                manager.GetPowerLimit(ref gpuInfo);

                gpuInfoList.Add(gpuInfo);
                gpuInfoListComboBox.Items.Add(gpuInfo.DisplayName);

                //Test get highest utilization of process id
                uint procId   = 0;
                uint procUtil = 0;
                if (manager.GetUtilizationSample(gpuInfo.Index, out procId, out procUtil) == true)
                {
                    utilResultLabel.Text = string.Format("proc id:{0} util:{1}", procId, procUtil);
                }
                else
                {
                    utilResultLabel.Text = "";
                }
            }

            Timer timer = new Timer();

            timer.Interval = 2000;
            timer.Tick    += (sender, e) =>
            {
                if (gpuInfoListComboBox.SelectedIndex < 0)
                {
                    return;
                }
                if (isAutoLoad == true && hasAutoLoaded == false)
                {
                    for (int i = 0; i < gpuInfoList.Count; i++)
                    {
                        var info  = gpuInfoList[i];
                        var state = manager.LoadInfoState(info.DisplayName);
                        UpdateValues(state.GpuFreqDelta, state.MemFreqDelta, (uint)state.CoolerLevels, state.PowerLimit, ref info);
                    }
                    hasAutoLoaded = true;
                }

                var  gpuInfo  = gpuInfoList[gpuInfoListComboBox.SelectedIndex];
                uint procId   = 0;
                uint procUtil = 0;
                if (manager.GetUtilizationSample(gpuInfo.Index, out procId, out procUtil) == true)
                {
                    utilResultLabel.Text = string.Format("proc id:{0} util:{1}", procId, procUtil);
                }
                else
                {
                    utilResultLabel.Text = "";
                }
            };
            timer.Start();

            gpuInfoListComboBox.SelectedIndexChanged += (sender, e) =>
            {
                var gpuInfo = gpuInfoList[gpuInfoListComboBox.SelectedIndex];
                pstateInfoLabel.Text = gpuInfo.DisplayPStateInfo;
                textBox1.Text        = gpuInfo.GpuFreqDelta.ToString();
                textBox2.Text        = gpuInfo.MemFreqDelta.ToString();
                textBox3.Text        = gpuInfo.CoolerLevels.ToString();
                textBox4.Text        = gpuInfo.PowerLimit.ToString();
                label4.Text          = "pwr " + gpuInfo.DefaultPowerLimit.ToString();
            };

            if (gpuInfoListComboBox.Items.Count > 0)
            {
                gpuInfoListComboBox.SelectedIndex = 0;
            }

            applyButton.Click += (sender, e) =>
            {
                if (gpuInfoListComboBox.Items.Count == 0 || gpuInfoListComboBox.SelectedIndex < 0)
                {
                    return;
                }

                int  gpu  = 0;
                int  mem  = 0;
                uint duty = 0;
                uint pwr  = 0;
                if (int.TryParse(textBox1.Text, out gpu) == true &&
                    int.TryParse(textBox2.Text, out mem) == true &&
                    uint.TryParse(textBox3.Text, out duty) == true &&
                    uint.TryParse(textBox4.Text, out pwr) == true)
                {
                    var gpuInfo = gpuInfoList[gpuInfoListComboBox.SelectedIndex];
                    UpdateValues(gpu, mem, duty, pwr, ref gpuInfo);

                    var state = new InfoState();
                    state.DisplayName  = gpuInfo.DisplayName;
                    state.GpuFreqDelta = gpuInfo.GpuFreqDelta;
                    state.MemFreqDelta = gpuInfo.MemFreqDelta;
                    state.CoolerLevels = (int)gpuInfo.CoolerLevels;
                    state.PowerLimit   = gpuInfo.PowerLimit;
                    manager.SaveInfoState(state);
                }
            };

            button1.Click += (sender, e) =>
            {
                try
                {
                    var searcher = new System.Management.ManagementObjectSearcher("root\\CIMV2", "select * from Win32_Processor");
                    var objs     = searcher.Get();
                    foreach (var obj in objs)
                    {
                        var obja = obj.Properties.Count;
                        foreach (var prop in obj.Properties)
                        {
                            if (prop.Name.Equals("Name"))
                            {
                                MessageBox.Show(prop.Value.ToString());
                            }
                        }
                        var objb = obj.GetPropertyValue("Name");
                    }
                    var cpuObject = new System.Management.ManagementObjectSearcher("root\\CIMV2", "select * from Win32_Processor")
                                    .Get()
                                    .Cast <System.Management.ManagementObject>()
                                    .First();
                    string fullName = cpuObject["Name"] as string;
                    MessageBox.Show(fullName);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message + "\n" + ex.StackTrace);
                }
            };
        }
예제 #9
0
 private bool Equals(GpuInfo other)
 {
     return(string.Equals(Name, other.Name) && NvapiId == other.NvapiId && NvmlId == other.NvmlId &&
            Bus == other.Bus && MinerMap == other.MinerMap && ComputeCapability == other.ComputeCapability);
 }
예제 #10
0
 public BenchmarkResults(GpuInfo gpuInfo, CpuInfo cpuInfo)
 {
     GpuInfo = gpuInfo;
     CpuInfo = cpuInfo;
     Scores  = new Dictionary <string, float>();
 }