I have worked with PAPI for three weeks then sorry if my question seems stupid .
In order to measure performance of one basic vector sum (depending of vector size), I use PAPI_rest(EventSet) and PAPI_read_counters(values, NB_EVENTS) functions . This functions are used un examples files of papi-5.1.1 (I use this PAPI version) .
My code compile with no problems but when I change gcc flags (and more particularly -O), results of my counters change ..
When I compile with -O0, results seem corrects with values around 1000 cycles for a vector size equals to 10^2 (and this values increase when the size rise) but when I compile with -O1, the number of cycles average 30 (maybe it's normal because of optimization and because others values continue to increase with vector size) .
The real problem is when I compile with -O2 or -O3 because the number of cycles average 10 for all the size of vectors i used (10², 10³, ... , 10⁷) and it happens the number of cycles for 10³ (for example) is bigger then 10⁶ (for example) . That the reason why i supposed there is maybe a problem and I asked the question here (tests with gcc-4.5, gcc-4.6 and gcc-4.7)
I work with Linux, PAPI-5.1.1, core i5 .
If I misunderstand something, please tell me what and it makes me feel happy if someone can answer or suggest something .
P.S : I'm very sorry for my bad English ..