Skip to content

Conversation

@bdux
Copy link

@bdux bdux commented Apr 30, 2023

No description provided.

@3rdMusketeer
Copy link

Would be great if this really did add the functionality as you say. How can we get response from the dev?

@amelokGH
Copy link

amelokGH commented Sep 8, 2023

Would be great if this really did add the functionality as you say. How can we get response from the dev?

No idea 😒 Maybe only by adding more comments from unhappy users like me and you! 😄

@Wazbaz-the-Weary
Copy link

Please, please update this @notadoctor99

Copy link

@Wazbaz-the-Weary Wazbaz-the-Weary left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent template as well

@3rdMusketeer
Copy link

@bdux does running locally require recompile with VS? How can one try to run locally? Really disappointing to be this close to a great plug-in and only have limited use case.

@bdux
Copy link
Author

bdux commented Dec 11, 2023

@bdux does running locally require recompile with VS? How can one try to run locally? Really disappointing to be this close to a great plug-in and only have limited use case.

Yeah, I had to set up the whole thing on my machine and build a new plugin version locally. And I don't know the first thing about Visual Studio... It was emotional.

@SlyRay
Copy link

SlyRay commented Feb 20, 2024

Sooooooo.....a few hours later I also managed to get the plugin working. Thx @bdux for the great work! Still...im not the best in C#. It was a little mess to understand what to do. But it works. :)

@bdux
Copy link
Author

bdux commented Apr 25, 2024

Sooooooo.....a few hours later I also managed to get the plugin working. Thx @bdux for the great work! Still...im not the best in C#. It was a little mess to understand what to do. But it works. :)

A bit late, but thank you! Glad it worked out!

@tsngr
Copy link

tsngr commented May 30, 2024

sry for the noob question but could anybody explain how i get this plugin to work or point me in the direction of what i need to learn in order to do that?

@PedroRamona
Copy link

hi, can you explain how do you recompile or add this GPU feature to the current version of the plugin? For us, normal human beings. thanks in advance.

@SlyRay
Copy link

SlyRay commented Jun 8, 2024

Hello guys! Some users tried to find me on discord and ask me how to add bdux code...sooo i will do a tutorial for you guys in the next few days. I don´t want hide such a cool feature. I'll let you know when i finish my work. Sooo, see you soon.

Edit 1: Good Day everyone! I haven't forgotten you yet. But as a family man and worker, I don't have enough time. I'll let you know when I'm finished.

Edit 2: Hello guys! Tutorial is ready to watch. You can click on my Github profil. Click on the YT Link to watch my video. I hope it helps you understand what you have to do. Have fun!

@mcmzero
Copy link

mcmzero commented Jun 30, 2024

Plugin File v2 - Add GPU Gauge & GPU Sensor

Plugin File v3 - Add Gauge AMD CPU and NVIDIA GPU: "Load, Temperature, HotSpot, Power"

Source Code

add GPU Sensor
`

    private Int32 GetAvailableSensors()
    {
        lock (this._sensorsByName)
        {
            this.ClearSensors();

            var stopwatch = new Stopwatch();
            stopwatch.Start();

            try
            {
                // read hardware IDs

                if (!this.TryGetProcessId(out var processId))
                {
                    PluginLog.Error("Cannot get sensors list. Is LibreHardwareMonitor running?");
                    return 0;
                }

                var cpuId = "";
                var gpuId = "";
                var memoryId = "";
                var batteryId = "";

                var hardwareQuery = $"SELECT HardwareType,Identifier FROM Hardware WHERE ProcessId = \"{processId}\"";
                using (var hardwareSearcher = new ManagementObjectSearcher(LibreHardwareMonitorScope, hardwareQuery))
                {
                    foreach (var hardware in hardwareSearcher.Get())
                    {
                        var hardwareType = hardware.GetHardwareType();
                        var hardwareIdentifier = hardware.GetIdentifier();

                        if (hardwareType.StartsWith("cpu", StringComparison.InvariantCultureIgnoreCase))
                        {
                            cpuId = hardwareIdentifier;
                        }
                        if (hardwareType.StartsWith("gpu", StringComparison.InvariantCultureIgnoreCase))
                        {
                            gpuId = hardwareIdentifier;
                        }
                        if (hardwareType.StartsWith("memory", StringComparison.InvariantCultureIgnoreCase))
                        {
                            memoryId = hardwareIdentifier;
                        }
                        if (hardwareType.StartsWith("battery", StringComparison.InvariantCultureIgnoreCase))
                        {
                            batteryId = hardwareIdentifier;
                        }
                    }
                }

                // read sensors

                var parentName = "CPU";
                var parentId = cpuId;

                AddSensor("Clock", @"{-}\n{0:N1} MHz");
                AddSensor("Load", @"CPU\n{0:N1} %");
                AddSensor("Power", @"{-}\n{0:N1} W");
                AddSensor("Temperature", @"{-}\n{0:N1} °C");
                AddSensor("Voltage", @"{-}\n{0:N3} V");

                parentName = "GPU";
                parentId = gpuId;

                AddSensor("Clock", @"GPU\n{0:N1} MHz");
                AddSensor("Load", @"GPU\n{0:N1} %");
                AddSensor("Power", @"GPU\n{0:N1} W");
                AddSensor("Temperature", @"GPU\n{0:N1} °C");

                parentName = "Memory";
                parentId = memoryId;

                AddSensor("Load", @"{-}\n{0:N1} %");
                AddSensor("Data", @"{-}\n{0:N1} GB");

                parentName = "Battery";
                parentId = batteryId;

                AddSensor("Level", @"{-}\n{0:N1} %");
                AddSensor("Voltage", @"{-}\n{0:N1} V");

                void AddSensor(String sensorType, String formatString)
                {
                    var sensorQuery = $"SELECT InstanceId,Identifier,Name,Value FROM Sensor WHERE ProcessId = \"{processId}\" AND Parent = \"{parentId}\" AND SensorType = \"{sensorType}\"";
                    using (var sensorSearcher = new ManagementObjectSearcher(LibreHardwareMonitorScope, sensorQuery))
                    {
                        foreach (var wmiSensor in sensorSearcher.Get())
                        {
                            var displayName = wmiSensor.GetDisplayName();

                            if (!displayName.Contains(" #"))
                            {
                                var name = $"{parentName}-{sensorType}-{displayName}".Replace(' ', '.');

                                var identifier = wmiSensor.GetIdentifier();

                                var gaugeType = LibreHardwareMonitorGaugeType.None;
                                if (identifier.EndsWithNoCase("/load/0") && displayName.EqualsNoCase("CPU Total"))
                                {
                                    gaugeType = LibreHardwareMonitorGaugeType.CPU;
                                }
                                else if (identifier.EqualsNoCase("/ram/load/0"))
                                {
                                    gaugeType = LibreHardwareMonitorGaugeType.Memory;
                                }
                                else if (identifier.EqualsNoCase("/battery/level/0") && displayName.EqualsNoCase("Charge Level"))
                                {
                                    gaugeType = LibreHardwareMonitorGaugeType.Battery;
                                }

                                var itemFormatString = formatString.Replace("{-}", displayName);
                                var itemDisplayName = $"[{parentName} {sensorType}] {displayName}";

                                var sensor = new LibreHardwareMonitorSensor(name, wmiSensor.GetInstanceId(), identifier, itemDisplayName, itemFormatString, wmiSensor.GetValue(), gaugeType);
                                this._sensorsByName[sensor.Name] = sensor;
                                this._sensorsById[sensor.Id] = sensor;

                                if (sensor.GaugeType != LibreHardwareMonitorGaugeType.None)
                                {
                                    this._sensorsByGaugeType[sensor.GaugeType] = sensor;
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                PluginLog.Error(ex, "Error getting sensor list");
            }

            // all done

            stopwatch.Stop();
            PluginLog.Info($"{this._sensorsByName.Count}/{this._sensorsById.Count}/{this._sensorsByGaugeType.Count} sensors found in {stopwatch.Elapsed.TotalMilliseconds:N0} ms");

            this.SensorListChanged?.BeginInvoke(this, new EventArgs());

            return this._sensorsByName.Count;
        }
    }

`

@Wazbaz-the-Weary
Copy link

thank you!!!

@florentin86
Copy link

Thank you! I have the one in the attached picture, it works ok except for CPU temp from gauges and the other CPU parameters from gauges, but for me it was important: CPU temp and load (load works)image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants