On Wed May 31 2006 9:58 am, Stephane Eranian wrote: > On Mon, May 08, 2006 at 10:11:29AM -0500, Kevin Corry wrote: > > Right now libpfm has the pfm_find_event_* and pfm_get_event_* APIs. My > > initial impression is that we could add APIs along the lines of > > pfm_find_event_mask_* and pfm_get_event_mask_*, which would search within > > one specified "parent" event for the specified mask information. And > > pfm_dispatch_events() and its input parameters would have to be updated > > to account for these event-masks. And obviously if a PMU doesn't have the > > notion of event-masks (like POWER4/5), then it simply doesn't need to > > provide any information for these new APIs. Any thoughts? > > I have been thinking about that new API too.
And while we're talking about libpfm, I have some questions about the existing APIs. First, I don't quite understand the purpose of the following APIs: pfm_find_event_by_code() pfm_find_event_by_code_next() pfm_get_event_code() Why would the caller care about the actual code for the event? That seems like it would be a fairly meaningless number unless you also knew exactly which PMC and which bit-position within the PMC to put it in. But the whole point of libpfm is to hide that level of detail from the caller. Also, the source for those APIs seems to treat the "code" as a unique number that can be used to identify an event. On Pentium4, that definitely isn't the case. Several events have the same "event-select" code, because those events cannot be counted on the same set of PMCs/PMDs. Similarly, in the arch-specific module APIs, what is the difference between get_event_code() and get_event_vcode()? From the i386 files, it looks like get_event_code() returns just the "event mask" (similar to the "event select" value for Pentium4), and get_event_vcode() returns the opaque value for the whole PMC. On Pentium4, that value is going to be incomplete until you've chosen which pair of PMCs to use for an event and which unit-masks to use. Also, Pentium4 uses two PMCs for each event (one ESCR and one CCCR). Which PMC value should be returned for the "vcode" API? What's the difference between get_impl_pmds() and get_impl_counters()? On i386, there are apparently 2 PMDs, but 4 counters? Are there counters that don't have corresponding PMDs? If so, how do they count anything? Why is there a get_num_counters() API, instead of simply a numerical field in the pfm_pmu_support_t structure like there is for pmc_count and pmd_count? Again, what's the distinction between PMCs, PMDs, and counters? Another note about the arch-specific module APIs - there seems to be a lot of inconsistency in how parameters and return values are passed. For instance, get_event_code() returns the code via pointer, but get_event_vcode() simply returns the vcode directly. Also, get_event_code() now takes a PMD number but get_event_vcode() doesn't. The get_event_name() routine simply returns a pointer to the event name string stored in the private array of events, but get_event_desc() strdup's the string and returns it by pointer. There are some routines that check that the event index passed in is valid, and some routines that just assume it is valid. Is there a reason for all the differences? Thanks! -- Kevin Corry [EMAIL PROTECTED] http://www.ibm.com/linux/ http://evms.sourceforge.net/ _______________________________________________ perfmon mailing list [email protected] http://www.hpl.hp.com/hosted/linux/mail-archives/perfmon/
