is there any builtIn library available in java to get the top 'n' cpu consuming process name and the percentage it's consuming.i want this program to work in any os such as windows,linux.
i tired with OperatingSystemMXBean but not sure this is the correct way and couldn't able to extract the necessary info.
totalCpuDuration()
method of the ProcessHandle.Info class, but that isn’t the percentage of CPU being used.