1

I'm looking to find the CPU usage of my java application. I found the best way to get CPU usage is (process_time/elapsed_time)*100.0. For a java application, the process_time is got by com.sun.management.OperatingSystemMXBean. Is there a way to calculate CPU usage using JVMTI.

Raj
  • 440
  • 2
  • 6
  • 22

1 Answers1

1

You can use OSHI for this. See the methods and documentation here OSHI

  • Hello and welcome to SO. Links to external resources are encouraged, but please add context around the link so your fellow users will have some idea what it is and why it’s there. Always quote the most relevant part of an important link, in case the external resource is unreachable or goes permanently offline. – schrom Jun 30 '21 at 12:24