I'm trying to gather the number of cycles every N instructions(N is fixed), using perf record or perf stat command on Linux.
However, when I tried using perf record -e cycles,instructions -c N, I only got the information on two separate events, which is not what I want.
Another attempt was made using perf record -I N .... However, it seems like the -I argument can only sample on the period of time, not the number of instructions.
The thread here Read performance counters periodically in linux suggested that we could write a script to do so. However, I couldn't get the point how to manipulate the interspersed data collected by two separate events.