Vivek,

On Tue, Oct 02, 2007 at 01:59:12PM -0400, [EMAIL PROTECTED] wrote:
> Hi Stephane, 
> 
> I have to start and stop monitoring multiple times in my program and  I am 
> using perfmonctl (the older interface) to do that. But I find that the 
> perfmonctl(PFM_START,....) gives me an error starting from the second call.
> 
> So, abstractly my sequence is :
> 
> start loop:
> ...
> perfmonctl(PFM_START,...)
> 
> 
> < Some code used to monitor the hw counters >
> 
> 
> perfmonctl(PFM_STOP,...)
> 
> goto start_loop:
> 
> It happens that if i don't have a lot of code in between, then everything is 
> fine, i get all the overflow interrupts that i want. However, normally my 
> iteration takes  around 12 seconds after which i find that the 
> perfmonctl(PFM_START,...) fails with invalid argument as the error. There is 
> only argument of relevance which is pfm_fd.  Can you suggest me what could be 
> the cause of this ?

You can ignore the error. The problem is that by the time you stop you have
a pending overflow. One way to avoid this would be for you to check whether you
have a pending message in the message queue. You can do this with a non-blocking
read(). If you have something then do the normal sample processing. I suspect
you will see that if you "drain" the sample this way, you will not see the error
anymore.

I am looking at new perfmon2 code base to see whether I could easily avoid the 
error
code.

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

Reply via email to