- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi everyone,
In a very simple code, these dayz, I am measuring the memory traffic, and I would like to be sure that my code is correct, and delivers relatively accurate results:
int main(void) { PCM * m = PCM::getInstance(); if (m->program() != PCM::Success) { cout << "Intel PCM does not Work"; exit(0); } SystemCounterState before_sstate = getSystemCounterState(); //some code to measure SystemCounterState after_sstate = getSystemCounterState(); cout << "Bytes read: "; cout << getBytesReadFromMC(before_sstate,after_sstate) / double(1024ULL * 1024ULL * 1024ULL) << endl; printf("done !"); m->cleanup(); exit(EXIT_SUCCESS); }
Also, I would like to know if there is cleaner way to end my Intel PCM code ? I ask this, because sometimes I have to reset the PMU by calling (for instance), pcm.x -r
Thanks in advance for your help :)
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Jeremie,
the way you end PCM measurement looks clean. Sometimes other programs (not PCM) using performance counters that run in parallel may disturb your measurements. Are you using Linux? An example of such program is Linux perf. However, PCM can be compiled in a mode that uses Linux perf to program core performance counters, this will avoid possible collisions. Uncomment "#CXXFLAGS += -DPCM_USE_PERF" in the Makefile to enable this mode.
Best regards,
Roman
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for your reply :)
So, if I am using Linux, it is more accurate to use Intel PCM compiled with the DPCM_USE_PERF ?
Other question:
In my code, above, what about the accuracy ? I mean, what about the sampling rate, etc.
I did not specify anything in the code about the sampling rate, is it normal ? what is the default sampling rate of Intel PCM ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yes, please use PCM_USE_PERF.
PCM does *NOT* use sampling. It uses "counting mode". That means the counters are read once in each getSystemCounterState call and then the difference between their values is computed.
Roman
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page