with
Runtime.getRuntime().availableProcessors();
I can get the numbers of CPU avaiable.
But how can I get their clock frequency?
I was searching for a os-indipendent solution.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
There is no feature available in the Java SE API which will return the frequency of the CPU.
Also, the
Runtime.availableProcessorsmethod returns the number of processors available to the Java virtual machine at the time the method is called, so it won’t necessarily return the number of actual processors in a system.From the Java API Specification for the
Runtime.availableProcessorsmethod:In order to obtain such information, most likely, one would have to make calls the operating system using native calls via Java Native Interface (JNI).