I need to write a small client application which gives CPU information such as CPU_TYPE, Processor_Speed, Serial number, UUID, operating system, physical memory and etc...
Does any one knows very straight approach for getting these information.
Thanks in advance Viswanathan G
If you are looking specifically for memory in JVM: Runtime runtime = Runtime. getRuntime(); NumberFormat format = NumberFormat. getInstance(); StringBuilder sb = new StringBuilder(); long maxMemory = runtime.
Press the Windows key , type task manager, and press Enter . In the window that appears, click the Performance tab. On the Performance tab, a list of hardware devices is displayed on the left side.
Java applications may take high CPU resources for many reasons: Poorly designed application code with inefficient or infinite loops. Inefficient algorithms (poor application logic) Recursive method calls (causing hundreds of recursions)
For CPU try org.hyperic.sigar.cmd.CpuInfo. For OS try System.getProperties().
On Windows you could use WMI to get the necessary information by simply executing a (or several) simple scripts.
On linux you can do something similar by parsing information out of proc/cpuinfo
and other stuff (not an expert there).
minimal example for win
I'm not aware of any framework that is crossplatform for this kind of information - mostly because there's just no way to get this information without delving deep into the platforms insides. Depending on how much data you need you may get by by parsing the data from some trivial scripts or you could use frameworks for all platforms you need.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With