Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

Java 

CPU Usage

Hey guys,
One Question... How can I get the CPU usage of my OS?
You can use the 'OperatingSystemMXBean' class assuming you're building with JDK 1.7

Code
long    getCommittedVirtualMemorySize()
Returns the amount of virtual memory that is guaranteed to be available to the running process in bytes, or -1 if this operation is not supported.

long    getFreePhysicalMemorySize()
Returns the amount of free physical memory in bytes.

long    getFreeSwapSpaceSize()
Returns the amount of free swap space in bytes.

double  getProcessCpuLoad()
Returns the "recent cpu usage" for the Java Virtual Machine process.

long    getProcessCpuTime()
Returns the CPU time used by the process on which the Java virtual machine is running in nanoseconds.

double  getSystemCpuLoad()
Returns the "recent cpu usage" for the whole system.

long    getTotalPhysicalMemorySize()
Returns the total amount of physical memory in bytes.

long    getTotalSwapSpaceSize()
Returns the total amount of swap space in bytes.


Possibly Related Threads...
Thread / Author Replies Views Last Post
[Shell] by Emre_Nov 3, 2020 10:03 AM 2 217 Nov 3, 2020 10:03 AM
Last Post: Emre_
[Java] by j10maxApr 30, 2017 03:16 PM 0 118 Apr 30, 2017 03:16 PM
Last Post: j10max
[.NET] by GoldyHackerJan 18, 2016 05:33 AM 20 558 Jan 18, 2016 05:33 AM
Last Post: GoldyHacker