System Monitor is a very easy to use application that will allow you to easily track and monitor all the CPU and memory usage for your Mac.
System Monitor is using some existing command line utilities. System Monitor uses the - top - command in order to get the CPU and Memory usage information.
You can also execute top using ProcessBuilder and get the Process instance. Get the output stream from process and read the output of top command. All you have to do next is parse this content (a bit tricky, each version had its own output format) to get the information.
Note: The implementation is not concrete (as it relies on simple text parsing), may not work on some platforms or locales due to difference in output of top command. It will not work on platforms which does not support top command.
Requirements:
· Java