Solved

Is there good API to take the system resource all around , like linux / windows / Itanium / Solaris

Posted on 2012-03-13
4
203 Views
Last Modified: 2012-03-14
Is there good API to take the system resource all around , like linux / windows / Itanium / Solaris.

I want to know the status of the resource all around the platforms.

used memory / cpu / top process like that.

Please recommend me the good API .
No matter commercial or not

Thanks in advance
0
Comment
Question by:gamjaradio
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
4 Comments
 
LVL 47

Assisted Solution

by:for_yan
for_yan earned 500 total points
ID: 37718498
This is about memory:

http://stackoverflow.com/questions/74674/how-to-do-i-check-cpu-and-memory-usage-in-java

  Runtime runtime = Runtime.getRuntime();

    NumberFormat format = NumberFormat.getInstance();

    StringBuilder sb = new StringBuilder();
    long maxMemory = runtime.maxMemory();
    long allocatedMemory = runtime.totalMemory();
    long freeMemory = runtime.freeMemory();

    sb.append("free memory: " + format.format(freeMemory / 1024) + "<br/>");
    sb.append("allocated memory: " + format.format(allocatedMemory / 1024) + "<br/>");
    sb.append("max memory: " + format.format(maxMemory / 1024) + "<br/>");
    sb.append("total free memory: " + format.format((freeMemory + (maxMemory - allocatedMemory)) / 1024) + "<br/>")

Open in new window

0
 

Author Comment

by:gamjaradio
ID: 37718502
actually I want know cpu percent per process.

like this

PID          used cpu percent
23122          20%
1920            30%
0
 
LVL 47

Assisted Solution

by:for_yan
for_yan earned 500 total points
ID: 37718503
I don't think you can have fully system indpednent way to list top processes
these are some examples:
http://stackoverflow.com/questions/54686/how-to-get-a-list-of-current-open-windows-process-with-java
0
 
LVL 47

Accepted Solution

by:
for_yan earned 500 total points
ID: 37718508
I don't think you can get top processes in system indepdnednt way
You can use Runtime.getRuntime().exec(...) and use specific commands for the system
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
Suggested Courses

737 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question