I would like to log CPU usage at a frequency of 1 second.
One possible way to do it is via vmstat 1
command.
The problem is that the time between each output is not always exactly one second, especially on a busy server. I would like to be able to output the timestamp along with the CPU usage every second. What would be a simple way to accomplish this, without installing special tools?