I\'m writing a small Linux application which logs the computer\'s power consumption along with CPU utilisation and disk utilisation. I\'d like to add the ability to log memory
It's highly CPU-dependent but you'll need to be able to get access to the CPU's performance registers. You may be able to do this via oprofile. Note that not all CPUs have a performance register (or combination of registers) which can be used to calculate to memory bandwidth usage, however.