I want to analyze system's performance for my application using PAPI api in C. The general structure is that
-- Initialize PAPI
-- Initialize counters of interest
-- start counters
-- run main logic of the application
-- end counters and read values
I want to read the counters periodically say every 1 second instead of reading the final values at the end of the application. does the PAPI output give the aggregate values at end of program execution like the total number of L2 cache misses after the program execution. Another example would be to read number of instructions at every time instance rather than total number of instructions at the end of the program.
Did you get any ideas regarding this? I am doing the same thing, but I am getting strange results: my counters are not updated as often as I'd like them.
For the record, here is a sample that I tested and works well: