使用Java检测CPU速度/内存/ Internet速度? [英] Detect CPU Speed/Memory/Internet Speed using Java?
问题描述
在Java中是否可以识别可用的总CPU速度以及总系统内存?网络连接到网络的速度也很棒。
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.
推荐答案
这真的取决于你的操作系统,因为Java会告诉你小关于底层机器。不幸的是,你必须根据你的操作系统使用不同的方法。
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.
如果你在Linux上,请看一下 / proc / cpuinfo
用于CPU信息的文件系统。 / proc
一般都有丰富的信息。网络(IO)将通过命令 ifconfig
反映出来。
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
.
如果你在Windows上,一个有用的工具是 WMI ,提供对各种低级硬件统计数据的访问。您可以通过的CScript 。有关WMI脚本的这是一个示例页面。
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.
这篇关于使用Java检测CPU速度/内存/ Internet速度?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!