Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Detect CPU Speed/Memory/Internet Speed using Java?

Is it possible within Java to identify the total CPU speed available as well as the total system memory? Network connection speed to the web would also be awesome.

like image 758
Kirk Ouimet Avatar asked Aug 19 '09 04:08

Kirk Ouimet


2 Answers

This really depends on your OS, since Java will tell you little about the underlying machine. Unfortunately you have to use differing approaches depending on your OS.

If you're on Linux, take a look at the /proc/cpuinfo filesystem for CPU info. /proc generally has a wealth of information. Network (IO) will be reflected via the command ifconfig.

If you're on Windows, a useful tool is WMI, which provides access to all sorts of low-level hardware stats. You can run WMI scripts via CScript. Here's a page of examples of WMI scripts.

like image 113
Brian Agnew Avatar answered Sep 18 '22 06:09

Brian Agnew


Maybe SIGAR can provide some of the things you need.

like image 34
fulkod Avatar answered Sep 18 '22 06:09

fulkod