A tool for profling databases using CPU performance counters