Hello, how to get to display information about the processor used in the system? Thank you in advance!
|
3 answers
I may suggest stupidity, but for now I see only the option of determining the type of OS, and then calling the appropriate applications of the OS itself via Runtime.exec (). For Ubuntu, for example, the application command is "lshw -class cpu". And then parse and watch.
- oneMaybe this will be enough: docs.oracle.com/javase/tutorial/essential/environment/… - VladD
- oneWell, if a person needs all the information about the processor - not enough, not there, as I see it, such a key. But to find out through this type of OS - for a sweet soul - Yuri_Prime
|
I saw how Intel decided this. They have the Intel® Intrinsics Guide utility, which displays information about the sse / mmx commands. And she can show which are available for the particular machine where the utility is running. They use jni and have written so / dll files for the three target platforms. I did not find it on the Intel website, but here are all the links .
|
System.out.println(System.getenv("PROCESSOR_IDENTIFIER")); System.out.println(System.getenv("PROCESSOR_ARCHITECTURE")); System.out.println(System.getenv("NUMBER_OF_PROCESSORS")); System.out.println("Available processors (cores): " + Runtime.getRuntime().availableProcessors());
- And this option is not cross-platform? Under Ubuntu, I issued: null null null Available processors (cores): 8. I have seen something like this, but this, if I am not mistaken, is an appeal to the Windows parameters. - Yuri_Prime
- @Yuri_Prime means not cross-platform :( - a_gura
|