I am using a tool called collectd, under linux, which gives me different cpu stats. I get:
cpu user mode
cpu system mode
cpu nice
cpu idle
cpu wait
cpu interrupt
cpu softirq
cpu steal
now, I'd like to combine these stats in order to get the cpu usage %. Any idea for that?
edit: Looking at the internet it seems that I can obtain, for example, the %cpu used in user space by subtracting two successive measurements of the cpu_user_mode stat (dividing by 100,ofc). Why is that? Those values represent the time cpu spent, from the boot, in those states...why if I subtract two measurements I obtain the %?