Phil,

On Wed, Nov 01, 2006 at 03:00:41PM +0100, Philip J. Mucci wrote:
> 
> Is there a way to adapt this code to tell me how many resulting PMD's I
> have left? PAPI trys to tell the user what is going on...I can see the
> support messages now. "Hey I have 4 counters, but I can only add 3,
> what's going on?"
> 
I think this is a good point. The pfm_get_impl_*() returns what the 
hardware actually implement which does not necessarily translate into
what you have available.

I think we could add the pfm_get_avail_*() equivalent based on the unavailable
PMC bitmask. Note that perfmon also returns the list of unavailable PMDs.
So I think already today PAPI could do:

        setf.set_id = 0;
        pfm_getinfo_evtsets(fd, &setf, 1)
        pfm_get_impl_counters(impl_cnt);
        available_counters = impl_cnt & ~setf.set_avail_pmds;

That reminds me, that I need to add helper function to query the
PMC/PMD logical mapping  to HW. pfm_dispatch_events() returns this
now. But I think it may be interesting to take a bitmap such as impl_cnt
and ask for the HW address/index of each implemented PMD.


> On Tue, 2006-10-31 at 11:48 -0800, Stephane Eranian wrote:
> > Your are trying to write pmc0. If on AMd64 or P6, pmc0 normally exist
> > UNLESS you have the NMI watchdog turned
> > on. Take a look in /sys/kernel/perfmon/pmu_desc, if you do not have a
> > pmc0 subdir, then that is probably the
> > issue.
> > 
> > I do not know how PAPI uses libpfm, but if you take a look at the
> > examples, you will see that they 
> > pass a bitmask pfp_unavail_pmcs to pfm_dispatch_events(). This is the
> > list of PMC that are not
> > available. Using this information libpfm, work around the PMC
> > limitations. You need to populate
> > the bitmask, in the example subdir, take a look a detect_pmcs.c. I
> > suspect PAPI is nott doing this, thus
> > libpfm returns an invalid assignment. Tools cannot assume they own the
> > entire PMU, they need to query
> > what's available.
> > 
> > Hope this helps. 
> 
> _______________________________________________
> perfmon mailing list
> [email protected]
> http://www.hpl.hp.com/hosted/linux/mail-archives/perfmon/

-- 

-Stephane
_______________________________________________
perfmon mailing list
[email protected]
http://www.hpl.hp.com/hosted/linux/mail-archives/perfmon/

Reply via email to