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.
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.