Re: [perfmon2] About per-thread monitoring
Status: Beta
Brought to you by:
seranian
From: Tanima D. <dey...@ya...> - 2009-07-18 23:02:35
|
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 <cja...@li...> To: Tanima Dey <dey...@ya...> Cc: Perfmon <per...@li...> 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 |