perf stat: Introduce perf_counts function