Hi Alex, On Wed, Aug 08, 2007 at 04:39:33PM -0700, Alex Shye wrote: > > I am trying to create a tool using libpfm which can sample L2 cache misses > via PEBS, but also collect information from event counters. As far as I > understand, there may be two ways to go about this: > > 1) Place the PEBS samples and the event counter samples in the sampling > buffer and collect all of the samples at the same time upon buffer > overflow. There is a default sampling buffer format for event counters, and > a PEBS sampling buffer format. However, I am not sure how to go about > placing both in the sampling buffer at the same time. Does it require a new > sampling buffer format to use both?
You cannot do this easily. You'd have to create your own format to deal with PEBS and that would copy the content of the PEBS buffer into another buffer. You cannot control the format of PEBS. > > 2) Use PEBS as normal, and configure other event counters, but do not place > these event counters into the sampling buffer. Instead, upon buffer > overflow, read the PMDs, and collect event counter information at a courser > granularity. I am trying this option currently but it does not seem to Yes, this is the simplest way of doing this if you are willing to live with the coarser granulrity with the other counter. > work. I have a tool which uses PEBS fine. But once I try to add another > event counter, pfm_dispatch_events does not return successfully. The first > counter is set to "MEM_LOAD_RETIRED:L2_MISS" as pfmlib_input.pfp_events[0] > and is the events to sample PEBS on. The second event I am trying to add is > "INSTRUCTIONS_RETIRED" at pfmlib_input.pfp_events[1]. Has anyone done this > before or have advice on how to do this? That's my fault. I used a simplistic model in libpfm where it assumes that when you do PEBS, you only do this. So it checks that only one event is passed. You are presenting a valid usage, so I need to lift the constraint in libpfm to let users programs other counters when PEBS is used. As a workaround while I fix this, I suggest you call libpfm once for the extra event you want. Given that this is INSTRUCTIONS_RETIRED, you'll end up with one of the fixed counters. Save the output parameters from pfm_dispatch_events(). Then call pfm_dispatch_events() a second time, just for PEBS. Merge the two output parameters, i.e., you'll have 3 PMCs and 2 PMDs. There is no overlap possible. -- -Stephane _______________________________________________ perfmon mailing list [email protected] http://www.hpl.hp.com/hosted/linux/mail-archives/perfmon/
