Using performance counters