Esempio n. 1
0
        private int onGetNvAPITemperature(int index)
        {
            this.lockBus();
            int temp = 0;

            try
            {
                var gpuArray = PhysicalGPU.GetPhysicalGPUs();
                if (index >= gpuArray.Length)
                {
                    this.unlockBus();
                    return(temp);
                }

                var e = gpuArray[index].ThermalInformation.ThermalSensors.GetEnumerator();
                while (e.MoveNext())
                {
                    var value = e.Current;
                    temp = value.CurrentTemperature;
                    break;
                }
            }
            catch { }
            this.unlockBus();
            return(temp);
        }
Esempio n. 2
0
        private int onGetNvAPIFanSpeed(int index, int coolerID)
        {
            this.lockBus();
            int speed = 0;

            try
            {
                var gpuArray = PhysicalGPU.GetPhysicalGPUs();
                if (index >= gpuArray.Length)
                {
                    this.unlockBus();
                    return(speed);
                }

                var e = gpuArray[index].CoolerInformation.Coolers.GetEnumerator();
                while (e.MoveNext())
                {
                    var value = e.Current;
                    if (value.CoolerId == coolerID)
                    {
                        speed = value.CurrentFanSpeedInRPM;
                        break;
                    }
                }
            }
            catch { }
            this.unlockBus();
            return(speed);
        }
Esempio n. 3
0
        public override int setSpeed(int value)
        {
            if (value > mMaxSpeed)
            {
                Value = mMaxSpeed;
            }
            else if (value < mMinSpeed)
            {
                Value = mMinSpeed;
            }
            else
            {
                Value = value;
            }

            LockBus();
            try
            {
                var gpuArray = PhysicalGPU.GetPhysicalGPUs();
                var info     = gpuArray[mIndex].CoolerInformation;
                info.SetCoolerSettings(mCoolerID, Value);
                IsSetSpeed = true;
                Console.WriteLine("NvAPIFanControl.setSpeed() : {0}, {1}", mCoolerID, Value);
            }
            catch { }
            UnlockBus();

            LastValue = Value;
            return(Value);
        }
Esempio n. 4
0
        private void createGPUTemp()
        {
            if (OptionManager.getInstance().IsNvAPIWrapper == true)
            {
                this.lockBus();
                try
                {
                    int gpuNum   = 2;
                    var gpuArray = PhysicalGPU.GetPhysicalGPUs();
                    for (int i = 0; i < gpuArray.Length; i++)
                    {
                        var gpu  = gpuArray[i];
                        var name = gpu.FullName;
                        while (this.isExistTemp(name) == true)
                        {
                            name = gpu.FullName + " #" + gpuNum++;
                        }

                        var temp = new NvAPITemp(name, i);
                        temp.onGetNvAPITemperatureHandler += onGetNvAPITemperature;
                        mSensorList.Add(temp);
                    }
                }
                catch { }
                this.unlockBus();
            }
        }
Esempio n. 5
0
        public static void Init()
        {
            try
            {
                NVIDIA.Initialize();
                PhysicalGPU[] gpus = PhysicalGPU.GetPhysicalGPUs();

                if (gpus.Length == 0)
                {
                    return;
                }

                gpuList = gpus.ToList();

                List <string> gpuNames = new List <string>();

                foreach (PhysicalGPU gpu in gpus)
                {
                    gpuNames.Add(gpu.FullName);
                }

                string gpuNamesList = string.Join(", ", gpuNames);

                Logger.Log($"Initialized Nvidia API. GPU{(gpus.Length > 1 ? "s" : "")}: {gpuNamesList}");
            }
            catch (Exception e)
            {
                Logger.Log("No Nvidia GPU(s) detected. You will not be able to use CUDA implementations.");
                Logger.Log($"Failed to initialize NvApi: {e.Message}\nIgnore this if you don't have an Nvidia GPU.", true);
            }
        }
Esempio n. 6
0
        public Devices()
        {
            Cpus = new List <CpuDevice>((int)KokkosLibrary.GetNumaCount());

            OperatingSystem os = Environment.OSVersion;

            for (int i = 0; i < (int)KokkosLibrary.GetNumaCount(); ++i)
            {
                Cpus.Add(new CpuDevice(i,
                                       $"{os.Platform:G}",
                                       (int)KokkosLibrary.GetCoresPerNuma(),
                                       (int)KokkosLibrary.GetCoresPerNuma() * (int)KokkosLibrary.GetThreadsPerCore(),
                                       new DeviceArch(RuntimeInformation.ProcessArchitecture == Architecture.X64 ? "x64" : "x86")));
            }

            Gpus = new List <GpuDevice>((int)KokkosLibrary.GetDeviceCount());

            uint gpuId = 0;

            foreach (PhysicalGPU physicalGpu in PhysicalGPU.GetPhysicalGPUs())
            {
                uint gpuVersion = KokkosLibrary.GetComputeCapability(gpuId);

                Gpus.Add(new CudaGpuDevice((int)gpuId,
                                           "Cuda",
                                           physicalGpu.ArchitectInformation.NumberOfCores,
                                           physicalGpu.ArchitectInformation.NumberOfCores,
                                           new DeviceArch(GetCudaDeviceName(gpuVersion), (int)gpuVersion),
                                           physicalGpu.UsageInformation));

                ++gpuId;
            }
        }
Esempio n. 7
0
        private void FormInfoPC_Load(object sender, EventArgs e)
        {
            var    infoPC    = new PCInformation();
            string releaseId = Registry.GetValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion", "ReleaseId", "").ToString(); // ~1809 version windows

            label_totalRam.Text = "TotalRAM: " + infoPC.totalRAMGlobal + " Mb";

            label_captionWin.Text = infoPC.captionWindowsGlobal + " (" + infoPC.OSArchitectureGlobal + ")" + " | Version: " + releaseId + " | Build(" + infoPC.versionGlobal + ")";

            label_totalVirtualMemory.Text = "TotalVirtualMemory: " + infoPC.totalVirtualMemoryGlobal + " Mb";

            label_captionProcessor.Text   = "CPU Name: " + infoPC.captionProcessorGlobal;
            label_numCores.Text           = "Count Cores: " + infoPC.numberOfCoresGlobal;
            label_nameUser.Text           = "User Name: " + infoPC.nameUserGlobal;
            label_nameComputer.Text       = "Computer Name: " + infoPC.nameComputerGlobal;
            label_productKey.Text         = "Product-key: " + infoPC.serialNumberGlobal;
            label_captionMotherBoard.Text = "Model: " + infoPC.captionMotherBoardGlobal;
            label_companyMotherBoard.Text = infoPC.companyMotherBoardGlobal;
            label_captionVideoCard.Text   = infoPC.captionVideoAdapterGlobal;
            if (infoPC.captionVideoAdapterGlobal.Contains("NVIDIA"))
            {
                object[] GPU_Info          = PhysicalGPU.GetPhysicalGPUs();
                var      MemoryInformation = GPU_Info[0].GetType().GetProperty("MemoryInformation").GetValue(GPU_Info[0]);
                label_CoolerInforamtion.Text = "Cooler: " + GPU_Info[0].GetType().GetProperty("CoolerInformation").GetValue(GPU_Info[0]) + "\n";
                label_BusInfromation.Text    = GPU_Info[0].GetType().GetProperty("BusInformation").GetValue(GPU_Info[0]) + "\n";
                label_MemoryInformation.Text = "Memory: " + "~" +
                                               (Convert.ToDouble(
                                                    MemoryInformation
                                                    .GetType()
                                                    .GetProperty("AvailableDedicatedVideoMemoryInkB")
                                                    .GetValue(MemoryInformation))
                                                / 1024)
                                               .ToString()
                                               + " Mb";
                label_RAMMake.Text = "RAM Maker: " +
                                     (
                    MemoryInformation
                    .GetType()
                    .GetProperty("RAMMaker")
                    .GetValue(MemoryInformation)
                                     )
                                     .ToString();
                label_RAMType.Text = "RAM Type: " +
                                     (
                    MemoryInformation
                    .GetType()
                    .GetProperty("RAMType")
                    .GetValue(MemoryInformation)
                                     )
                                     .ToString();
            }
            else
            {
                MessageBox.Show("///GPU-Info work only NVIDIA-family///", "Err0R");
                MainForm mf = new MainForm();
                this.Close();
                mf.Show();
            }
        }
Esempio n. 8
0
        public IEnumerable <NvidiaGpuWrapper> GetPhysicalGPUs()
        {
            ICollection <NvidiaGpuWrapper> output = new HashSet <NvidiaGpuWrapper>();

            PhysicalGPU[] gpus = PhysicalGPU.GetPhysicalGPUs();
            gpus.ToList().ForEach(gpu => output.Add(new NvidiaGpuWrapper(gpu)));
            return(output);
        }
Esempio n. 9
0
 private static void PrintPhysicalGPUs()
 {
     ConsoleWriter.Default.PrintCaption("PhysicalGPU.GetPhysicalGPUs()");
     ConsoleNavigation.Default.PrintNavigation(PhysicalGPU.GetPhysicalGPUs(), (i, gpu) =>
     {
         ConsoleWriter.Default.WriteObject(gpu, 0);
     }, "Select a GPU to show additional information");
 }
Esempio n. 10
0
 private static void PrintGPUCoolers()
 {
     ConsoleWriter.Default.PrintCaption("PhysicalGPU.GetPhysicalGPUs()");
     ConsoleNavigation.Default.PrintNavigation(PhysicalGPU.GetPhysicalGPUs(), (i, gpu) =>
     {
         ConsoleWriter.Default.PrintCaption("PhysicalGPU.CoolerInformation");
         ConsoleWriter.Default.WriteObject(gpu.CoolerInformation.Coolers.ToArray());
     }, "Select a GPU to show cooler values");
 }
Esempio n. 11
0
 private static void PrintGPUPerformanceStates()
 {
     ConsoleWriter.Default.PrintCaption("PhysicalGPU.GetPhysicalGPUs()");
     ConsoleNavigation.Default.PrintNavigation(PhysicalGPU.GetPhysicalGPUs(), (i, gpu) =>
     {
         ConsoleWriter.Default.PrintCaption("PhysicalGPU.PerformanceStatesInfo");
         ConsoleWriter.Default.WriteObject(gpu.PerformanceStatesInfo, 3);
     }, "Select a GPU to show performance states configuration");
 }
Esempio n. 12
0
 private static void PrintGPUSensors()
 {
     ConsoleWriter.Default.PrintCaption("PhysicalGPU.GetPhysicalGPUs()");
     ConsoleNavigation.Default.PrintNavigation(PhysicalGPU.GetPhysicalGPUs(), (i, gpu) =>
     {
         ConsoleWriter.Default.PrintCaption("PhysicalGPU.ThermalSensors");
         ConsoleWriter.Default.WriteObject(gpu.ThermalInformation.ThermalSensors.ToArray());
     }, "Select a GPU to show thermal sensor values");
 }
Esempio n. 13
0
        private void createGPUControl()
        {
            // Gigabyte
            if (mIsGigabyte == true)
            {
            }

            // LibreHardwareMonitor
            else if (OptionManager.getInstance().LibraryType == LibraryType.LibreHardwareMonitor)
            {
                mLHM.createGPUFanControl(ref mControlList);
            }

            // OpenHardwareMonitor
            else
            {
                mOHM.createGPUFanControl(ref mControlList);
            }

            if (OptionManager.getInstance().IsNvAPIWrapper == true)
            {
                this.lockBus();
                try
                {
                    int gpuFanNum = 1;
                    var gpuArray  = PhysicalGPU.GetPhysicalGPUs();
                    for (int i = 0; i < gpuArray.Length; i++)
                    {
                        var e = gpuArray[i].CoolerInformation.Coolers.GetEnumerator();
                        while (e.MoveNext())
                        {
                            var          value         = e.Current;
                            int          coolerID      = value.CoolerId;
                            int          speed         = value.CurrentLevel;
                            int          minSpeed      = value.DefaultMinimumLevel;
                            int          maxSpeed      = value.DefaultMaximumLevel;
                            CoolerPolicy defaultPolicy = value.DefaultPolicy;

                            var name = "GPU Fan Control #" + gpuFanNum++;
                            while (this.isExistControl(name) == true)
                            {
                                name = "GPU Fan Control #" + gpuFanNum++;
                            }

                            var control = new NvAPIFanControl(name, i, coolerID, speed, minSpeed, maxSpeed, defaultPolicy);
                            control.onSetNvAPIControlHandler += onSetNvApiControl;
                            mControlList.Add(control);
                        }
                    }
                }
                catch { }
                this.unlockBus();
            }
        }
Esempio n. 14
0
        private static void Main()
        {
            var paths = new Dictionary <object, Action>
            {
                {
                    "View Embedded EDID Sample",
                    () => { BrowseEDID(Resources.EDID, "Embedded EDID Sample"); }
                },
                {
                    "Read From Display Using NVIDIA GPU",
                    () =>
                    {
                        ConsoleNavigation.PrintObject(
                            PhysicalGPU.GetPhysicalGPUs()
                            .SelectMany(gpu => gpu.GetConnectedDisplayDevices(ConnectedIdsFlag.None))
                            .ToArray(),
                            display =>
                        {
                            var edidData = display.PhysicalGPU.ReadEDIDData(display.Output);
                            BrowseEDID(edidData,
                                       $"DisplayDevice #{display.DisplayId} @ {display.PhysicalGPU.FullName} EDID Data");
                        }, "NVIDIA Displays", "Select a Display to parse EDID data.");
                    }
                },
#if !NETCOREAPP
                {
                    "Read From Windows Registry",
                    () =>
                    {
                        ConsoleNavigation.PrintObject(Display.GetDisplays().ToArray(), display =>
                        {
                            byte[] edidData;
                            using (var key = display.OpenDevicePnPKey())
                            {
                                using (var subkey = key.OpenSubKey("Device Parameters"))
                                {
                                    // ReSharper disable once PossibleNullReferenceException
                                    edidData = (byte[])subkey.GetValue("EDID", null);
                                }
                            }
                            BrowseEDID(edidData, $"{display.DisplayName} @ {display.Adapter.DeviceName} EDID Data");
                        }, "Windows Displays", "Select a Display to parse EDID data.");
                    }
                }
#endif
            };

            ConsoleNavigation.PrintNavigation(paths, "EDID Parser Sample",
                                              "Select an option to explore EDID parser functionalities.");
        }
Esempio n. 15
0
        private void createGPUFan()
        {
            // Gigabyte
            if (mIsGigabyte == true)
            {
            }

            // LibreHardwareMonitor
            else if (OptionManager.getInstance().LibraryType == LibraryType.LibreHardwareMonitor)
            {
                mLHM.createGPUFan(ref mFanList);
            }

            // OpenHardwareMonitor
            else
            {
                mOHM.createGPUFan(ref mFanList);
            }

            if (OptionManager.getInstance().IsNvAPIWrapper == true)
            {
                this.lockBus();
                try
                {
                    int gpuFanNum = 1;
                    var gpuArray  = PhysicalGPU.GetPhysicalGPUs();
                    for (int i = 0; i < gpuArray.Length; i++)
                    {
                        var e = gpuArray[i].CoolerInformation.Coolers.GetEnumerator();
                        while (e.MoveNext())
                        {
                            var value = e.Current;
                            var name  = "GPU Fan #" + gpuFanNum++;
                            while (this.isExistFan(name) == true)
                            {
                                name = "GPU Fan #" + gpuFanNum++;
                            }

                            var fan = new NvAPIFanSpeed(name, i, value.CoolerId);
                            fan.onGetNvAPIFanSpeedHandler += onGetNvAPIFanSpeed;
                            mFanList.Add(fan);
                        }
                    }
                }
                catch { }
                this.unlockBus();
            }
        }
Esempio n. 16
0
 private void onSetNvApiControl(int index, int coolerID, int value)
 {
     this.lockBus();
     try
     {
         var gpuArray = PhysicalGPU.GetPhysicalGPUs();
         if (index >= gpuArray.Length)
         {
             this.unlockBus();
             return;
         }
         var info = gpuArray[index].CoolerInformation;
         info.SetCoolerSettings(coolerID, value);
     }
     catch { }
     this.unlockBus();
 }
Esempio n. 17
0
 public override void update()
 {
     LockBus();
     try
     {
         var gpuArray = PhysicalGPU.GetPhysicalGPUs();
         var e        = gpuArray[mIndex].ThermalInformation.ThermalSensors.GetEnumerator();
         while (e.MoveNext())
         {
             var value = e.Current;
             Value = value.CurrentTemperature;
             break;
         }
     }
     catch { }
     UnlockBus();
 }
Esempio n. 18
0
        public static string GetGpuName()
        {
            try
            {
                NVIDIA.Initialize();
                PhysicalGPU[] gpus = PhysicalGPU.GetPhysicalGPUs();
                if (gpus.Length == 0)
                {
                    return("");
                }

                return(gpus[0].FullName);
            }
            catch
            {
                return("");
            }
        }
Esempio n. 19
0
 public override void update()
 {
     LockBus();
     try
     {
         var gpuArray = PhysicalGPU.GetPhysicalGPUs();
         var e        = gpuArray[mIndex].CoolerInformation.Coolers.GetEnumerator();
         while (e.MoveNext())
         {
             var cur = e.Current;
             if (cur.CoolerId == mCoolerID)
             {
                 LastValue = Value = cur.CurrentLevel;
                 break;
             }
         }
     }
     catch { }
     UnlockBus();
 }
Esempio n. 20
0
 public override void update()
 {
     LockBus();
     try
     {
         var gpuArray = PhysicalGPU.GetPhysicalGPUs();
         var e        = gpuArray[mIndex].CoolerInformation.Coolers.GetEnumerator();
         while (e.MoveNext())
         {
             var value = e.Current;
             if (value.CoolerId == mCooerID)
             {
                 Value = value.CurrentFanSpeedInRPM;
                 break;
             }
         }
     }
     catch { }
     UnlockBus();
 }
Esempio n. 21
0
        private static void PrintGPUSensors()
        {
            // NVIDIA.Initialize();

            var test = PhysicalGPU.GetPhysicalGPUs();

            PhysicalGPU.GetPhysicalGPUs();
            tamerelapute = test[0].ThermalInformation.ThermalSensors.ToArray();
            string _arraytemp = tamerelapute[0].ToString();

            string parseGPUTemp = _arraytemp.Substring(_arraytemp.IndexOf(":") + 2);

            finalGPUTemp = parseGPUTemp.Substring(0, parseGPUTemp.IndexOf("°"));

            zebilamoule = test[0].UsageInformation.GPU.ToString();
            string parseGPUsage = zebilamoule.Substring(zebilamoule.IndexOf(" ") + 1);

            finalGPUSage = parseGPUsage.Remove(parseGPUsage.Length - 1);
            Debug.WriteLine(finalGPUTemp);
            Debug.WriteLine(finalGPUSage);
        }
Esempio n. 22
0
        public static void GpuThread()
        {
            Debug.WriteLine("Starting Gpu");
            int gpuCycles = 0;
            var GPUs      = PhysicalGPU.GetPhysicalGPUs();



            while (true)
            {
                try
                {
                    System.Threading.Thread.Sleep(waitTime);
                    gpu = GPUs[0].UsageInformation.GPU.Percentage;
                    UpdateGraphs(0, gpu);
                    //Debug.WriteLine("updating gpu: " + gpu);
                    if (gpu > gpuThreshold)
                    {
                        if (gpuCycles < 20)
                        {
                            gpuCycles++;
                        }
                        else
                        {
                            Toast("High GPU usage detected!", "Info");
                            gpuCycles = 0;
                        }
                    }
                    else
                    {
                        gpuCycles = 0;
                    }
                }
                catch (Exception e)
                {
                    Debug.WriteLine(e);
                    Debug.WriteLine("<---!	GPU inactive !--->");
                }
            }
        }
Esempio n. 23
0
        public override void setAuto()
        {
            if (IsSetSpeed == false)
            {
                return;
            }

            LockBus();
            try
            {
                var gpuArray = PhysicalGPU.GetPhysicalGPUs();
                var info     = gpuArray[mIndex].CoolerInformation;

                //info.RestoreCoolerSettingsToDefault(mCoolerID);
                info.SetCoolerSettings(mCoolerID, mDefaultCoolerPolicy);
                //info.SetCoolerSettings(mCoolerID, NvAPIWrapper.Native.GPU.CoolerPolicy.None);
                IsSetSpeed = false;
                Console.WriteLine("NvAPIFanControl.setAuto() : {0}", mCoolerID);
            }
            catch { }
            UnlockBus();
        }
Esempio n. 24
0
        public static async void Init()
        {
            try
            {
                NVIDIA.Initialize();
                PhysicalGPU[] gpus = PhysicalGPU.GetPhysicalGPUs();
                if (gpus.Length == 0)
                {
                    return;
                }
                gpu = gpus[0];

                while (true)
                {
                    RefreshVram();
                    await Task.Delay(1000);
                }
            }
            catch (Exception e)
            {
                Logger.Log($"Failed to initialize NvApi: {e.Message}\nIgnore this if you don't have an Nvidia GPU.");
            }
        }
Esempio n. 25
0
 private int GetCurrentPCIeLanes()
 {
     return(GPUApi.GetCurrentPCIEDownStreamWidth(PhysicalGPU.GetPhysicalGPUs()[0].Handle));
 }
Esempio n. 26
0
        private static void Main(string[] args)
        {
            _writer = new StreamWriter(new FileStream(
                                           string.Format("HeliosDisplayManagement.Reporting.{0}.log", Process.GetCurrentProcess().Id),
                                           FileMode.CreateNew));

            try
            {
                Dump(DisplayAdapter.GetDisplayAdapters(), "WindowsDisplayAPI.DisplayAdapter.GetDisplayAdapters()");
            }
            catch (Exception e)
            {
                WriteException(e);
            }

            try
            {
                Dump(Display.GetDisplays(), "WindowsDisplayAPI.Display.GetDisplays()", new[]
                {
                    new Tuple <Func <Display, object>, string>(display => display.GetPossibleSettings(),
                                                               "GetPossibleSettings()")
                });
            }
            catch (Exception e)
            {
                WriteException(e);
            }

            try
            {
                Dump(UnAttachedDisplay.GetUnAttachedDisplays(),
                     "WindowsDisplayAPI.UnAttachedDisplay.GetUnAttachedDisplays()");
            }
            catch (Exception e)
            {
                WriteException(e);
            }

            try
            {
                Dump(PathDisplayAdapter.GetAdapters(),
                     "WindowsDisplayAPI.DisplayConfig.PathDisplayAdapter.GetAdapters()",
                     new[]
                {
                    new Tuple <Func <PathDisplayAdapter, object>, string>(adapter => adapter.ToDisplayAdapter(),
                                                                          "ToDisplayAdapter()")
                });
            }
            catch (Exception e)
            {
                WriteException(e);
            }

            try
            {
                Dump(PathDisplaySource.GetDisplaySources(),
                     "WindowsDisplayAPI.DisplayConfig.PathDisplaySource.GetDisplaySources()", new[]
                {
                    new Tuple <Func <PathDisplaySource, object>, string>(source => source.ToDisplayDevices(),
                                                                         "ToDisplayDevices()")
                });
            }
            catch (Exception e)
            {
                WriteException(e);
            }

            try
            {
                Dump(PathDisplayTarget.GetDisplayTargets(),
                     "WindowsDisplayAPI.DisplayConfig.PathDisplayTarget.GetDisplayTargets()", new[]
                {
                    new Tuple <Func <PathDisplayTarget, object>, string>(target => target.ToDisplayDevice(),
                                                                         "ToDisplayDevice()")
                });
            }
            catch (Exception e)
            {
                WriteException(e);
            }

            try
            {
                if (PathInfo.IsSupported)
                {
                    Dump(PathInfo.GetActivePaths(), "WindowsDisplayAPI.DisplayConfig.PathInfo.GetActivePaths()", null,
                         2);
                }
            }
            catch (Exception e)
            {
                WriteException(e);
            }

            try
            {
                Dump(LogicalGPU.GetLogicalGPUs(), "NvAPIWrapper.GPU.LogicalGPU.GetLogicalGPUs()", null, 1);
            }
            catch (Exception e)
            {
                WriteException(e);
            }

            try
            {
                Dump(PhysicalGPU.GetPhysicalGPUs(), "NvAPIWrapper.GPU.PhysicalGPU.GetPhysicalGPUs()");
            }
            catch (Exception e)
            {
                WriteException(e);
            }

            try
            {
                Dump(NvAPIWrapper.Display.Display.GetDisplays(), "NvAPIWrapper.Display.Display.GetDisplays()", new[]
                {
                    new Tuple <Func <NvAPIWrapper.Display.Display, object>, string>(
                        display => display.GetSupportedViews(),
                        "GetSupportedViews()")
                });
            }
            catch (Exception e)
            {
                WriteException(e);
            }

            try
            {
                Dump(NvAPIWrapper.Display.UnAttachedDisplay.GetUnAttachedDisplays(),
                     "NvAPIWrapper.Display.UnAttachedDisplay.GetUnAttachedDisplays()");
            }
            catch (Exception e)
            {
                WriteException(e);
            }

            try
            {
                Dump(NvAPIWrapper.Display.PathInfo.GetDisplaysConfig(),
                     "NvAPIWrapper.Display.PathInfo.GetDisplaysConfig()",
                     null, 3);
            }
            catch (Exception e)
            {
                WriteException(e);
            }

            try
            {
                Dump(GridTopology.GetGridTopologies(), "NvAPIWrapper.Mosaic.GridTopology.GetGridTopologies()", null, 3);
            }
            catch (Exception e)
            {
                WriteException(e);
            }


            try
            {
                Dump(Profile.GetAllProfiles(), "HeliosDisplayManagement.Shared.Profile.GetAllProfiles()", null, 99);
            }
            catch (Exception e)
            {
                WriteException(e);
            }

            _writer.Flush();
            _writer.Close();
            _writer.Dispose();

            Console.WriteLine(@"Done, press enter to exit.");
            Console.ReadLine();
        }
Esempio n. 27
0
        private double onOSDSensorUpdate(OSDLibraryType libraryType, int index, int subIndex)
        {
            double value = 0;

            if (libraryType == OSDLibraryType.NvApiWrapper)
            {
                this.lockBus();
                try
                {
                    var gpuArray = PhysicalGPU.GetPhysicalGPUs();
                    var gpu      = gpuArray[index];

                    switch (subIndex)
                    {
                    case 0:
                        value = (double)gpu.CurrentClockFrequencies.GraphicsClock.Frequency;
                        break;

                    case 1:
                        value = (double)gpu.CurrentClockFrequencies.MemoryClock.Frequency;
                        break;

                    case 2:
                        value = (double)gpu.CurrentClockFrequencies.ProcessorClock.Frequency;
                        break;

                    case 3:
                        value = (double)gpu.CurrentClockFrequencies.VideoDecodingClock.Frequency;
                        break;

                    case 4:
                        value = (double)gpu.UsageInformation.GPU.Percentage;
                        break;

                    case 5:
                        value = (double)gpu.UsageInformation.FrameBuffer.Percentage;
                        break;

                    case 6:
                        value = (double)gpu.UsageInformation.VideoEngine.Percentage;
                        break;

                    case 7:
                        value = (double)gpu.UsageInformation.BusInterface.Percentage;
                        break;

                    case 8:
                        value = (double)(((double)gpu.MemoryInformation.PhysicalFrameBufferSizeInkB - (double)gpu.MemoryInformation.CurrentAvailableDedicatedVideoMemoryInkB) / (double)gpu.MemoryInformation.PhysicalFrameBufferSizeInkB * 100.0);
                        break;

                    case 9:
                        value = (double)gpu.MemoryInformation.CurrentAvailableDedicatedVideoMemoryInkB;
                        break;

                    case 10:
                        value = (double)(gpu.MemoryInformation.PhysicalFrameBufferSizeInkB - gpu.MemoryInformation.CurrentAvailableDedicatedVideoMemoryInkB);
                        break;

                    case 11:
                        value = (double)gpu.MemoryInformation.PhysicalFrameBufferSizeInkB;
                        break;

                    default:
                        value = 0;
                        break;
                    }
                }
                catch { }
                this.unlockBus();
            }
            return(value);
        }
Esempio n. 28
0
        private (int, int) GetGPU()
        {
            PhysicalGPU GPU = PhysicalGPU.GetPhysicalGPUs()[0];

            return(GPU.UsageInformation.GPU.Percentage, GPU.ThermalInformation.ThermalSensors.ToArray()[0].CurrentTemperature);
        }
Esempio n. 29
0
        static async Task Main(string[] args)
        {
            if (!OperatingSystem.IsWindows())
            {
                throw new NotSupportedException("This application is designed to support only Windows OS.");
            }

            // This program is use to demonstrate the usage of VirtualGrid library
            // by capture some parameters from system information
            // and create an effect to reflect those parameters accordingly.

            var cpuCounter        = new PerformanceCounter("Processor", "% Processor Time", "_Total");
            var memoryCounter     = new PerformanceCounter("Memory", "Available MBytes");
            var totalMemoryMBytes = GC.GetGCMemoryInfo().TotalAvailableMemoryBytes / 1024 / 1024;
            var gpu = PhysicalGPU.GetPhysicalGPUs().FirstOrDefault();

            var backgroundGrid = new VirtualLedGrid(30, 9);

            backgroundGrid.Set(new Color(0, 16, 0));

            var grid = new VirtualLedGrid(30, 9);

            // Order of grid matters, predecessor grids will get override by successor grids.
            // in this example the green background will get override by custom system color in some area.
            using var mediator = new PhysicalDeviceMediator(backgroundGrid, grid);

            mediator.Attach <RazerKeyboardAdapter>(0, 1);
            mediator.Attach <RazerMousepadAdapter>(0, 0);
            mediator.Attach <RazerMouseAdapter>(23, 0);
            mediator.Attach <RazerHeadsetAdapter>(25, 7);
            mediator.Attach <RazerChromaLinkAdapter>(12, 8);

            var cpuGrid    = grid.Slice(2, 2, 12, 1);
            var memoryGrid = grid.Slice(2, 3, 12, 1);
            var diskGrid   = grid.Slice(2, 4, 11, 1);
            var gpuGrid    = grid.Slice(2, 5, 11, 1);

            var cpuColor    = new Color(17, 125, 187);
            var memoryColor = new Color(139, 18, 174);
            var diskColor   = new Color(77, 166, 12);

            var cpuIdleColor         = new Color(2, 12, 19);
            var memoryAvailableColor = new Color(14, 2, 17);
            var diskAvailableColor   = new Color(8, 17, 1);

            for (; ;)
            {
                cpuGrid.Set(cpuIdleColor);
                memoryGrid.Set(memoryAvailableColor);
                diskGrid.Set(diskAvailableColor);
                gpuGrid.Set(cpuIdleColor);

                var cpuUtilize         = cpuCounter.NextValue() / 100f;
                var currentMemoryUsage = memoryCounter.NextValue();
                var memoryUtilize      = 1.0f - (currentMemoryUsage / totalMemoryMBytes);
                var gpuUtilize         = (gpu?.UsageInformation.GPU.Percentage ?? 0) / 100f;

                var cpuGridLength    = (int)(cpuGrid.ColumnCount * cpuUtilize);
                var memoryGridLength = (int)(memoryGrid.ColumnCount * memoryUtilize);
                var gpuGridLegth     = (int)(gpuGrid.ColumnCount * gpuUtilize);

                var diskInfo         = new DriveInfo("C");
                var freeSpacePercent = (double)(diskInfo.TotalSize - diskInfo.TotalFreeSpace) / diskInfo.TotalSize;
                var diskGridLength   = (int)(diskGrid.ColumnCount * (freeSpacePercent));

                for (var cpuCol = 0; cpuCol < cpuGridLength; cpuCol++)
                {
                    cpuGrid[cpuCol, 0] = cpuColor;
                }

                for (var memoryCol = 0; memoryCol < memoryGridLength; memoryCol++)
                {
                    memoryGrid[memoryCol, 0] = memoryColor;
                }

                for (var diskCol = 0; diskCol < diskGridLength; diskCol++)
                {
                    diskGrid[diskCol, 0] = diskColor;
                }

                for (var gpuCol = 0; gpuCol < gpuGridLegth; gpuCol++)
                {
                    gpuGrid[gpuCol, 0] = cpuColor;
                }

                await mediator.ApplyAsync();

                await Task.Delay(100);
            }
        }
Esempio n. 30
0
        private void createOSDSensor()
        {
            if (mIsGigabyte == true)
            {
            }

            // LibreHardwareMonitor
            else if (OptionManager.getInstance().LibraryType == LibraryType.LibreHardwareMonitor)
            {
                mLHM.createOSDSensor(ref mOSDSensorList);
            }

            // OpenHardwareMonitor
            else if (OptionManager.getInstance().LibraryType == LibraryType.OpenHardwareMonitor)
            {
                mOHM.createOSDSensor(ref mOSDSensorList);
            }

            if (OptionManager.getInstance().IsNvAPIWrapper == true)
            {
                this.lockBus();
                try
                {
                    var gpuArray = PhysicalGPU.GetPhysicalGPUs();
                    for (int i = 0; i < gpuArray.Length; i++)
                    {
                        int subIndex = 0;

                        var osdSensor = new OSDSensor(OSDUnitType.kHz, "[Clock] GPU Graphics", i, subIndex++);
                        osdSensor.onOSDSensorUpdate += onOSDSensorUpdate;
                        mOSDSensorList.Add(osdSensor);

                        osdSensor = new OSDSensor(OSDUnitType.kHz, "[Clock] GPU Memory", i, subIndex++);
                        osdSensor.onOSDSensorUpdate += onOSDSensorUpdate;
                        mOSDSensorList.Add(osdSensor);

                        osdSensor = new OSDSensor(OSDUnitType.kHz, "[Clock] GPU Processor", i, subIndex++);
                        osdSensor.onOSDSensorUpdate += onOSDSensorUpdate;
                        mOSDSensorList.Add(osdSensor);

                        osdSensor = new OSDSensor(OSDUnitType.kHz, "[Clock] GPU Video Decoding", i, subIndex++);
                        osdSensor.onOSDSensorUpdate += onOSDSensorUpdate;
                        mOSDSensorList.Add(osdSensor);

                        osdSensor = new OSDSensor(OSDUnitType.Percent, "[Load] GPU Core", i, subIndex++);
                        osdSensor.onOSDSensorUpdate += onOSDSensorUpdate;
                        mOSDSensorList.Add(osdSensor);

                        osdSensor = new OSDSensor(OSDUnitType.Percent, "[Load] GPU Frame Buffer", i, subIndex++);
                        osdSensor.onOSDSensorUpdate += onOSDSensorUpdate;
                        mOSDSensorList.Add(osdSensor);

                        osdSensor = new OSDSensor(OSDUnitType.Percent, "[Load] GPU Video Engine", i, subIndex++);
                        osdSensor.onOSDSensorUpdate += onOSDSensorUpdate;
                        mOSDSensorList.Add(osdSensor);

                        osdSensor = new OSDSensor(OSDUnitType.Percent, "[Load] GPU Bus Interface", i, subIndex++);
                        osdSensor.onOSDSensorUpdate += onOSDSensorUpdate;
                        mOSDSensorList.Add(osdSensor);

                        osdSensor = new OSDSensor(OSDUnitType.Percent, "[Load] GPU Memory", i, subIndex++);
                        osdSensor.onOSDSensorUpdate += onOSDSensorUpdate;
                        mOSDSensorList.Add(osdSensor);

                        osdSensor = new OSDSensor(OSDUnitType.KB, "[Data] GPU Memory Free", i, subIndex++);
                        osdSensor.onOSDSensorUpdate += onOSDSensorUpdate;
                        mOSDSensorList.Add(osdSensor);

                        osdSensor = new OSDSensor(OSDUnitType.KB, "[Data] GPU Memory Used", i, subIndex++);
                        osdSensor.onOSDSensorUpdate += onOSDSensorUpdate;
                        mOSDSensorList.Add(osdSensor);

                        osdSensor = new OSDSensor(OSDUnitType.KB, "[Data] GPU Memory Total", i, subIndex++);
                        osdSensor.onOSDSensorUpdate += onOSDSensorUpdate;
                        mOSDSensorList.Add(osdSensor);
                    }
                }
                catch { }
                this.unlockBus();
            }
        }