JavaFX – System Monitor


My previous post on LineChart uses simulated CPU usage data. Just thought of updating that to show live CPU and Memory information.

A tribute to all    users

For Applet mode, click on above image

For standalone mode

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


var dzone_url = “http://blogs.sun.com/rakeshmenonp/entry/javafx_system_monitor”;
var dzone_style = ‘2’;

Advertisements

About Rakesh Menon
-

6 Responses to JavaFX – System Monitor

  1. Vaibhav says:

    works fine on my system and looks cool too, are you planning to give out the source?

  2. Rakesh Menon says:

    @Vaibhav Sure! I have uploaded the source. Its mostly java and involves plain text parsing.

  3. Gian says:

    The chart looks very nice, is it a standard JavaFX component?
    Keep up the good work!

  4. Rakesh Menon says:

    @Gian Thanks! Yes, its part of JavaFX 1.2 Refer to javafx.scene.chart package. http://java.sun.com/javafx/1.2/docs/api/

  5. Nihar says:

    Hi , Rakesh this example is really informative..
    thanks for posting..
    Well i am facing little problem…. i have create one custom list view based on the sample code given by you on http://javafx.com/samples/Tweeter/
    but now when i am trying to add more items like around 900 items it is showing me
    java.lang.OutOfMemoryError: Java heap space
    error at runtime … so could you just tell me how to resolve it so that my list view can take enough number of records..

  6. Rakesh Menon says:

    @Nihar Sorry that approach is not scalable. You may try http://jfxstudio.wordpress.com/2009/06/20/a-custom-virtual-list/ Proper fix will be available in next release.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: