I want to use pure java to get the stats of disk and network. Especially: In Java, how to get disk write and read bytes per seconds, network tx bytes and rx bytes per seconds?
Is that possible?
I want to use pure java to get the stats of disk and network. Especially: In Java, how to get disk write and read bytes per seconds, network tx bytes and rx bytes per seconds?
Is that possible?
The proc
file system and sysfs
give access to statistics like this.
You can read the network tx and rx from /proc/net/dev
for example.
Disk statistics can be found in /proc/diskstats
.
I believe you're asking something similar to the following: Detect CPU Speed/Memory/Internet Speed using Java?.
You may also have some success using the java.lang.management
package. Some boilerplate is described here.