Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Measure Free Memory/CUP using Java

 
Chetan Parekh
Ranch Hand
Posts: 3640
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to measure Free Memory and Free CUP available on a given time using Java.

I know that there is not cross platform solution for it and I need this for Windows Platform only.

Anybody has C/C++ code or DLL that I can call from Java?

Any other solutions?
 
Aryan Khan
Ranch Hand
Posts: 290
Java Oracle Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you tried


Ahmad
 
Chetan Parekh
Ranch Hand
Posts: 3640
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I found following details in Java API:

Runtime.freeMemory(): Returns the amount of free memory in the Java Virtual Machine.
Runtime.maxMemory(): Returns the maximum amount of memory that the Java virtual machine will attempt to use.
Runtime.totalMemory(): Returns the total amount of memory in the Java virtual machine.

They are JVM sepcific. They are not dealing with the System Memory.
 
Aryan Khan
Ranch Hand
Posts: 290
Java Oracle Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Maybe your answer.
http://forum.java.sun.com/thread.jspa?threadID=425258&messageID=1891830
 
Cameron Wallace McKenzie
author and cow tipper
Saloon Keeper
Posts: 4968
1
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What about using the JVMPI?

JVMPI - The Old Java Virtual Machine Performance Interface

Cheers!

-Cameron McKenzie
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic