The example “for (int i = 0; i < 200000000; i++) (int *)p_data = i;” is compiled with ICC 16.0.3.
I have checked the assemble of the store instruction: movdqa. It means each cache line will be read first.
The PCM result shows:
BytesReadFromMC: 47615872 (wrong number)
BytesWrittenToMC: 808465920 (right number).
Do I need to modify the lines in cpucounters.cpp:
It looks like this is an attempt to measure behavior for the initial access to the array. The behavior of the system for page instantiation may not be what you expect.
I recommend that you add more loops to read/write the data after it is initialized, and that you make the number of times the data is accessed after initialization an easy-to-modify variable. You should then see that you get the expected memory access counts for subsequent accesses.