center of tech

In my previous post - LineChart. Its using simulated data. Just thought of updating that to show live CPU and Memory information.
This is my tribute to all
users
For Applet mode, click on above image
One of the way to implement this is to use some existing command line utilities. I used - top - command to get the CPU and Memory usage information. Execute top using ProcessBuilder, get the Process instance. Get the output stream from process and read the output of top command. Now 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.
Try it out and let me know feedback
Source/Kaynak : http://blogs.sun.com/rakeshmenonp/entry/javafx_system_monitor