Git Product home page Git Product logo

jsensors's People

Contributors

deki avatar pascmarchand avatar profesorfalken avatar roelgo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

jsensors's Issues

Temporarily created Lib is deleted after some time

public static String generateLibTmpPath(String path, String libName) {

This function is called when the sensors lib is not exist in Linux OS then jSensor will create a Lib on a temp path from JAR resource. On Red Hat Enterprise Linux, the created file does not exist after some time. It can be fixed as the below code.

	public static String generateLibTmpPath(String path, String libName) {
	    if (tempFile == null || !tempFile.exists()) {
            InputStream in = SensorsUtils.class.getResourceAsStream(path + libName);
            try {
                tempFile = File.createTempFile(libName, "");
                tempFile.deleteOnExit();
                byte[] buffer = new byte[1024];
                int read;
                FileOutputStream fos = new FileOutputStream(tempFile);
                while ((read = in.read(buffer)) != -1) {
                    fos.write(buffer, 0, read);
                }
                fos.close();
                in.close();
            } catch (IOException ex) {
                LOGGER.error("Cannot generate temporary file", ex);
                return "";
            }
        }

		return tempFile.getAbsolutePath();
	}

performance issues when updating sensors

I want to monitor hardware resources and output the values (temp, fan, load) onto a screen in realtime, which means fresh values at least every second. But I am wondering when I use
JSensors.get.components();
it takes around 5 seconds or more. When I output values in realtime without calling JSensors.get.components(); every time the values are not refreshing...
Is it not possible to stream hardware statistics in realtime?

Not showing temperature

It detects the cpu and gpu names but not showing gpu temperature.
cpu - i5 11400
gpu - Rx 6400
works fine with cpu .
i have even added new openhardware.dll file

Deprecated JNA method loadLibrary

jnaProxy = Native.loadLibrary("sensors", CSensors.class);

jnaProxy = Native.loadLibrary(libPath, CSensors.class);

These 2 lines use a deprecated JNA method com.sun.jna.Native.loadLibrary(String,Class). It can be replaced with the com.sun.jna.Native.load(String,Class) method.

is empty

fun main() {
    val components = JSensors.get.components()

    val cpus = components.cpus
    if (cpus != null) {
        for (cpu in cpus) {
            println("Found CPU component: " + cpu.name)
            if (cpu.sensors != null) {
                println("Sensors: ")

                //Print temperatures
                val temps = cpu.sensors.temperatures
                for (temp in temps) {
                    println(temp.name + ": " + temp.value + " C")
                }

                //Print fan speed
                val fans = cpu.sensors.fans
                for (fan in fans) {
                    println(fan.name + ": " + fan.value + " RPM")
                }
            }
        }
    }
}

ouput

Found CPU component: AMD Ryzen 5 3600X 6-Core Processor
Sensors:
Found CPU component: AMD Ryzen 5 3600X 6-Core Processor
Sensors:

Not working on Windows 10

I've been running the code from readme.md but i got cpus and gpus list size equals to 0.

CPU: AMD Athlon 64
GPU: GTX 950 Strix

What's the problem, man? 😄

Error

Hello, I tried to use jSensors for a university project, but I always get this error:

Exception in thread "main" java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory
at com.profesorfalken.jsensors.SensorsConfig.(SensorsConfig.java:33)
at com.profesorfalken.jsensors.JSensors.(JSensors.java:51)
at com.profesorfalken.jsensors.JSensors.(JSensors.java:41)
at monitoradordetemperatura.MonitoradorDeTemperatura.main(MonitoradorDeTemperatura.java:25)
Caused by: java.lang.ClassNotFoundException: org.slf4j.LoggerFactory
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 4 more
C:\Users\YiazmaT\AppData\Local\NetBeans\Cache\8.2\executor-snippets\run.xml:53: Java returned: 1
FALHA NA CONSTRUÇÃO (tempo total: 1 segundo)

Any Ideas on how to solve it? I'm just running the basic tests on README.
It says that the problem is on this line:
Components components = JSensors.get.components();
Thanks!

CPU sensors.temperature and sensors.fan are equals to 0. no output for sensors

i copy-past this code from main page
` Components components = JSensors.get.components();

List<Cpu> cpus = components.cpus;
if (cpus != null) {
    for (final Cpu cpu : cpus) {
        System.out.println("Found CPU component: " + cpu.name);
        if (cpu.sensors != null) {
          System.out.println("Sensors: ");

          //Print temperatures
          List<Temperature> temps = cpu.sensors.temperatures;
          for (final Temperature temp : temps) {
              System.out.println(temp.name + ": " + temp.value + " C");
          }

          //Print fan speed
          List<Fan> fans = cpu.sensors.fans;
          for (final Fan fan : fans) {
              System.out.println(fan.name + ": " + fan.value + " RPM");
          }
        }
    }
}`

but output is this:
` Found CPU component: Intel Core i7-7700HQ
Sensors:

Process finished with exit code 0`

if i chek size of cpu.sensors.temperatures and cpu.sensors.fan are 0

any suggestion?

GUI is gone

The jar file is not executable anymore and I can't even find the GUI class.

Program never quits

I'm running a basic piece of code to get the GPU's temps, but it never finishes running, here is the code:

import java.util.Date;
import java.util.List;

import com.profesorfalken.jsensors.JSensors;
import com.profesorfalken.jsensors.model.components.Components;
import com.profesorfalken.jsensors.model.components.Cpu;
import com.profesorfalken.jsensors.model.components.Gpu;
import com.profesorfalken.jsensors.model.sensors.Temperature;

public class App {
  public static void main(String[] args) {
    Components components = JSensors.get.components();

    List<Gpu> gpus = components.gpus;

    if (gpus != null) {
      List<Temperature> temps = gpus.get(0).sensors.temperatures;
      System.out.println(temps.size());
      for (Temperature temp : temps) {
        System.out.println(temp.name + ": " + temp.value);
      }
    }

    System.out.println("At the end");
  }
}

It prints "At the end", but never stops running.

CPU Temp shows 0°C

I have an i5 8600K, which gets recognized by the software. It shows the Load of each core but not the Temperature?
Is there something I or you can do to help me?

SensorsManager.getSensors: ArrayIndexOutOfBoundsException

java.lang.ArrayIndexOutOfBoundsException: 1
at com.profesorfalken.jsensors.manager.SensorsManager.getSensors(SensorsManager.java:100)
at com.profesorfalken.jsensors.manager.SensorsManager.getCpu(SensorsManager.java:66)
at com.profesorfalken.jsensors.manager.SensorsManager.getComponents(SensorsManager.java:54)
at com.profesorfalken.jsensors.SensorsLocator.getComponents(SensorsLocator.java:34)
at com.profesorfalken.jsensors.JSensors.components(JSensors.java:73)
at org.jutils.jhardware.util.TemperatureUtils.getCpuTemperatureByjSensors(TemperatureUtils.java:41)
at org.jutils.jhardware.util.TemperatureUtils.getCpuTemperatureForWindows(TemperatureUtils.java:59)
at org.jutils.jhardware.info.processor.windows.WindowsProcessorInfo.parseInfo(WindowsProcessorInfo.java:54)
at org.jutils.jhardware.info.processor.AbstractProcessorInfo.getInfo(AbstractProcessorInfo.java:29)
at org.jutils.jhardware.info.processor.AbstractProcessorInfo.getInfo(AbstractProcessorInfo.java:25)
at org.jutils.jhardware.HardwareInfo.getProcessorInfo(HardwareInfo.java:52)

I cant see nothing

I execute this:
`Components components = JSensors.get.components();

    List<Cpu> cpus = components.cpus;
    if (cpus != null) {
        for (final Cpu cpu : cpus) {
            System.out.println("Found CPU component: " + cpu.name);
            if (cpu.sensors != null) {
              System.out.println("Sensors: ");

              //Print temperatures
              List<Temperature> temps = cpu.sensors.temperatures;
              for (final Temperature temp : temps) {
                  System.out.println(temp.name + ": " + temp.value + " C");
              }

              //Print fan speed
              List<Fan> fans = cpu.sensors.fans;
              for (final Fan fan : fans) {
                  System.out.println(fan.name + ": " + fan.value + " RPM");
              }
            }
        }
    }`

and i take this:
[main] INFO com.profesorfalken.jsensors.manager.unix.UnixSensorsManager - Cannot find library in system, using embedded one [main] ERROR com.profesorfalken.jsensors.manager.unix.UnixSensorsManager - Cannot initialize sensors
I use Debian 11.

how to open this XD

ok i opened this project in intelij, but theres no public static boid main and u cant run it :/

can't read the templature

can't read the templature, output is
"
Found CPU component: Intel Core i5-3320M
Sensors:
Temp CPU Core #1: 0.0 C
Temp CPU Core #2: 0.0 C
Temp CPU Package: 0.0 C
Load CPU Core #1: 35.22728
Load CPU Core #2: 26.13636
Load CPU Total: 30.68182
Load Memory: 74.63326
Found disk component: Generic Hard Disk
Sensors:
Load Used Space: 83.86135
", my OS is window 10

You have not executed jSensors in Administrator mode

i added jSensors as a maven dependecy to my project and i am trying to get temp's in a rest controller, so when i run my applicatioin with intellij idea, i get this message

2019-07-13 23:31:11.881 WARN 18120 --- [nio-8080-exec-1] com.profesorfalken.jsensors.JSensors : You have not executed jSensors in Administrator mode, so CPU temperature sensors will not be detected.

how could i solve?

CPU Sensors show 0.0 for temperature.

I've updated the latest version of OpenHardwareMonitorLib (the 0.8.0 version) in the jar file, but still the code fails to detect the temperature. I can understand if this is not supported by my computer, but when I run the actual Open Hardware Monitor executable, it picks up the temperatures.
How can I know if my computer can support this?

RPM fan

how do i get RPM from the fan connected to cpu fan?
thank you.

No Output

@profesorfalken
I include all .jar files and try to run example code which is

List cpus = components.cpus;
if (cpus != null) {
for (final Cpu cpu : cpus) {
System.out.println("Found CPU component: " + cpu.name);
if (cpu.sensors != null) {
System.out.println("Sensors: ");

          //Print temperatures
          List<Temperature> temps = cpu.sensors.temperatures;
          for (final Temperature temp : temps) {
              System.out.println(temp.name + ": " + temp.value + " C");
          }

          //Print fan speed
          List<Fan> fans = cpu.sensors.fans;
          for (final Fan fan : fans) {
              System.out.println(fan.name + ": " + fan.value + " RPM");
          }
        }
    }
}

cpus.size() getting 0;
But there is no ouput also there is no error.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.