Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Determining minimum memory requirement and CPU usage

I have been working on one Java software project, which will be deployed to various hardware devices (e.g., raspberry pi, android phone).

Before releasing this project as product, I would like to guide users by clearly stating the minimum requirements (in terms of memory and CPU) or hardware device the user must have in order to run our software product.

How can I measure them? What are tools available for Java?

like image 776
Pankesh Avatar asked May 21 '15 06:05

Pankesh


2 Answers

You may take help of jvisualvm path of this tool is Program Files\Java\jdk1.6.0_38\bin\jvisualvm.exe

You may use it to determine your cpu utilization and memory consumption.

enter image description here

As you can see your CPU utilization and memory utilization. Hope this tool may help you.

like image 191
Amit Singh Avatar answered Oct 05 '22 22:10

Amit Singh


You can get the Total memory allotted to the JVM with:

Runtime.getRuntime().totalMemory();

and the Free memory(the unused memory allotted to the JVM) with:

Runtime.getRuntime().freeMemory();

So, to get the memory in use, you can subtract the free memory from the total memory.

So, you could do something like this:

long Total_Memory =Runtime.getRuntime().totalMemory(); long Free_Memory=Runtime.getRuntime().freeMemory(); long Memory =Total_Memory-Free_Memory;

like image 44
Paul Avatar answered Oct 05 '22 23:10

Paul