Can you post the code where you are doing the fork/exec of the app, and
following ptrace call?  Maybe we can spot the problem easier that way,
because I'm a little confused about the terminology "appThread".  If
appThread is a pthread id, that would be the reason that ptrace is not
working...  it takes task ids, rather than pthread ids.

- Corey

Tanima Dey <dey_tr...@yahoo.com> wrote on 07/18/2009 03:55:02 PM:

> Tanima Dey <dey_tr...@yahoo.com>
> 07/18/2009 03:55 PM
>
> To
>
> Corey Ashford <cjash...@linux.vnet.ibm.com>
>
> cc
>
> Perfmon <perfmon2-devel@lists.sourceforge.net>
>
> Subject
>
> Re: [perfmon2] About per-thread monitoring
>
> Hi,
> Yes, I have studied that example, and wrote similar code, but for
> the appThread. But it shows me the same error message for ptrace()
> while attaching the task. I have given the appThread ID instead of
> the process ID, and it shows the message:
>
> "cannot attach to threadID, operation is not permitted"
>
> Can you help?
> Thanks
> Tanima.
>
> From: Corey Ashford <cjash...@linux.vnet.ibm.com>
> To: Tanima Dey <dey_tr...@yahoo.com>
> Cc: Perfmon <perfmon2-devel@lists.sourceforge.net>
> Sent: Friday, July 17, 2009 6:20:09 PM
> Subject: Re: [perfmon2] About per-thread monitoring
>
> On 07/16/2009 04:33 PM, Tanima Dey wrote:
> >
> > Hi,
> >
> > Thanks for the reply.
> >
> > It is mentioned in the manual that the thread to which the context is
> > attached is the monitored thread, in my case then it is the application
> > thread to which the context should be loaded, right? If it is so, I am
> > initializing and loading the context in the appThread, and trying to
> > read the counters value in the monitor thread. So I have used ptrace()
> > to stop the appThread in the monitor thread and trying to read the
> > counters, but it is showing the error message: Cannot attach: Operation
> > not permitted. Also I tried to read by saving the file descriptor
> > variable, it is also not working.
> >
> > Must the per-thread monitoring always be self-monitoring? Otherwise, I
> > think it will always be the case that the monitoring thread wont have
> > any access to PMU state initialized by the appThread.
> >
> > What wrong I am doing here?Do you have any examples for perthread
> > monitoring using threads?
> >
>
> You can monitor from the same thread or from another thread, or from
> another thread in a different process.
>
> Have you looked at libpfm/examples_v2.x/task_attach.c ?
>
> It is an example of monitoring events in another task (i.e. process or
> thread).
>
> - Corey
>
------------------------------------------------------------------------------

> Enter the BlackBerry Developer Challenge
> This is your chance to win up to $100,000 in prizes! For a limited time,
> vendors submitting new applications to BlackBerry App World(TM) will have
> the opportunity to enter the BlackBerry Developer Challenge. See full
prize
> details at: http://p.sf.net/sfu/Challenge
> _______________________________________________
> perfmon2-devel mailing list
> perfmon2-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/perfmon2-devel
------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
perfmon2-devel mailing list
perfmon2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/perfmon2-devel

Reply via email to