profiler: Cache previous values of counters
Instead of outputting all of the counters on every profiler tick when most of them don't change from one tick to the next, we cache the previous value of each counter, and only output it to Sysprof if it has changed.
Closes: #551 (closed)