2010/11/22 <x...@ict.ac.cn>: > hi, > > I am writing my own app using the libpfm 3.10 API (interface v2.x) on a > X86 system. > > I setup a sampling context for the target-process to sample every 1 > million insts retired. Traditionally, I should wait for the buffer > overflow message and process with the sampling buffer and then restart. > But I use another different mechanism (I will explain why, later) that I > setup another timer to count for a while (1s) and then stop the > target-process with PTRACE_ATTACH. I set the buffer big enough to ensure > it would not overflow before the timer expires. After reading the sampling > entries, I try to reset the buffer using pfm_restart(), but it failed with > error EBUSY (hdr_count field in the buffer header didn't reset). > > So, how to reset sampling buffer before it overflows? > Are you doing this with the kernel code in the GIT tree or a released patch?
I looked at the code in __pfm_restart() and you cannot call pfm_restart() if you did not get a notification (can_restart> 0), unfortunately. I think this is because pfm_restart() does more than just reset the buffer. It also reloads the sampling periods. > I do this because actually I am monitoring multiple processes that run > concurrently, I would like a inst-based sampling for each process. > However, due to their IPC difference, their sampling buffers won't > overflow simultaneously. That would involves CPU fragment if I wait for > all the buffers to overflow in my single-threaded program. > > Thanks very much! > > > > ------------------------------------------------------------------------------ Increase Visibility of Your 3D Game App & Earn a Chance To Win $500! Tap into the largest installed PC base & get more eyes on your game by optimizing for Intel(R) Graphics Technology. Get started today with the Intel(R) Software Partner Program. Five $500 cash prizes are up for grabs. http://p.sf.net/sfu/intelisp-dev2dev _______________________________________________ perfmon2-devel mailing list perfmon2-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/perfmon2-devel