Vivek, Look at notify_self2.c. It is not system-wide but it can be converted fairly easily.
On Mon, Sep 03, 2007 at 04:13:35PM -0400, [EMAIL PROTECTED] wrote: > Stephane, > On Monday 03 September 2007 13:36, Stephane Eranian wrote: > > Vivek, > > > > On Mon, Sep 03, 2007 at 01:27:54PM -0400, [EMAIL PROTECTED] wrote: > > > Stephane, > > > > > > Thanks a lot for such a prompt reply ! Please see my inlined comments. > > > > > > On Monday 03 September 2007 12:28, Stephane Eranian wrote: > > > > Vivek, > > > > > > > > On Mon, Sep 03, 2007 at 11:49:11AM -0400, [EMAIL PROTECTED] wrote: > > > > > Hi ! > > > > > > > > > > I am trying to use perfmon on Itanium 2 server (HP's testdrive td178 > > > > > machine ). I have a multi-threaded program but each thread can be > > > > > pinned to a different CPU (total 16 cores here). Each thread is going > > > > > to monitor its own overflow (i.e. receive its own overflow > > > > > notification). For configuring this, do i need to set > > > > > PFM_FL_SYSTEM_WIDE while creating PFM_CONTEXT ? > > > > > > > > In system-wide perfmon requires that you create as many contexts and > > > > you have CPU core to monitor. That each context is loaded onto the > > > > right CPU core via pfm_load_context(). On IA-64 currently, you are > > > > using the v2.0 interface which has the PFM_LOAD_CONTEXT command. On > > > > this version, perfmon will pick the CPU used to mke the > > > > PFM_LOAD_CONTEXT call as the CPU to monitor. This means you need to > > > > ensure that you have pinned the caller thread to the right CPU core > > > > prior to making the call. Each context needs to be created with the > > > > PFM_FL_SYSTEM_WIDE flag set. > > > > > > Setting the PFM_FL_SYSTEM_WIDE flag at the context creation time gives > > > me the following error at the time I write to PMCs. > > > PFM_WRITE_PMCS:: Invalid argument > > > perfmonctl error PFM_WRITE_PMCS errno 22 > > > > > > The flags I am passing with PFM_WRITE_PMCS are : > > > /* > > > * indicate we want notification when buffer is full > > > */ > > > pc[0].reg_flags |= PFM_REGFL_OVFL_NOTIFY; > > > /* > > > * indicate which PMD to include in the sample > > > */ > > > pc[0].reg_smpl_pmds[0] = DEAR_REGS_MASK; > > > > > > This code works if I remove PFM_FL_SYSTEM_WIDE flag at the time of > > > context creation. > > > > Oh, I think for this kernel version, there was an explicit check for the > > PMC.pm bit when running in system wide. You need to use the libpfm > > PFMLIB_PFP_SYSTEMWIDE on the pfmlib_input_param_t.pfp_flags of > > pfm_dispatch_events(). > > > > This restriction has been removed for current versions, the kernel > > automatically forces the PMC.pm bit for system-wide contexts. > > > > -- > > My code compiles fine and runs without error using the above method. But I > don't see any overflow signals now. I was trying to look for some similar > examples in libpfm. > syst.c is one but it doesn't use threads and just pins the process on a > random > cpu. It also doesn't have any signal handling mechanism. Can you point me to > some example code which does what I want ? > > -Stephane. > > -Vivek -- -Stephane _______________________________________________ perfmon mailing list [email protected] http://www.hpl.hp.com/hosted/linux/mail-archives/perfmon/
