I created a program in java and I want to know its CPU usage when it is being run. Is there any function? Can you help me please?
Thank you in advance!
I created a program in java and I want to know its CPU usage when it is being run. Is there any function? Can you help me please?
Thank you in advance!
Use the tools in your operating system, say: in Windows you can see this information in the task manager, or in Linux use the top
command.
I would suggest running jconsole
, it will give you these statistics for all currently running Java applications. It can be found in the bin
directory of your Java installation.
This might be useful. The link will take you to an older post with a similar problem.
Use the tool that comes with the java SDK called VisualVM. It can show you much much more than just CPU usage, in real time.