I'm using python and psutil a library to get system informations like cpu usage (percent) for a given process.
My question is if I have the value in % of the cpu usage how I could get the cpu usage in cycle number I mean not in percent?
What does 'cycle number' even mean on a modern machine where different instructions take a different number of cycles and the CPU clock speed itself may vary over time?
Try psutil.process get_cpu_times which returns a tuple.
You can then get the sum of cpu speed x each element of the tuple. That gives you cycles. psutil does not return cpu speed AFAIK or so the docset says. You can read the /proc/cpuinfo "file" on linux to get that information.
I meant that I would like to evaluate the load that a given process bring to the CPU but not in percent.
I'm giving a look around and found that I should refer to user time, system time, start time and current time for the given process and use:
(user-time+system-time)/(current time - start time)