We help IT Professionals succeed at work.

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

gamjaradio
gamjaradio asked
on
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
Comment
Watch Question

Awarded 2011
Awarded 2011
Commented:
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

Author

Commented:
actually I want know cpu percent per process.

like this

PID          used cpu percent
23122          20%
1920            30%
Awarded 2011
Awarded 2011
Commented:
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
Awarded 2011
Awarded 2011
Commented:
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

Explore More ContentExplore courses, solutions, and other research materials related to this topic.