I am trying to measure some performance counters on Ivy Bridge, which has 4 PCM. I would like to know if there is a way to group up counters so that I can measure events on the same time.

For example, I need to measure 8 counters (e.g., A,B,C,D,E,F,G,H). And I would like to sample A,B,C,D together and E,F,G,H together.

How can I do this using libpfm? I saw that task.c on perf_examples has a way to group up counters, but I couldn't use it.

Thank you for any help,