oops .. typo Corey J Ashford/Beaverton/i...@ibmus wrote on 07/22/2009 11:29:22 AM:
> I know for a fact that it's possible to ptrace attach to threads (tasks). > We have a tool which relies on that + perfmon2 for per-thread performance > monitoring. > > If you are really curious, you could start digging into the kernel code to > figure out where that "operation not permitted" error is coming from, and > perhaps that could lead to a clue as to what is going on. > > On the other hand, Stephane the 2.6.30 perfmon2 won't require ptrace, so ^ said > if you can wait, that would be a better solution. > > - Corey > > Tanima Dey <dey_tr...@yahoo.com> wrote on 07/22/2009 07:57:32 AM: > > > Hi, > > Yes the line 136 prints the application thread id correctly. I also > > don't know what could be the problem. May be ptrace does not allow > > threadID as parameter. When will the version 2.6.30 be available? > > > > Thanks > > Tanima. > > > > From: Corey J Ashford <cjash...@us.ibm.com> > > To: Tanima Dey <dey_tr...@yahoo.com> > > Cc: Corey Ashford <cjash...@linux.vnet.ibm.com>; Perfmon <perfmon2- > > de...@lists.sourceforge.net> > > Sent: Tuesday, July 21, 2009 12:12:15 AM > > Subject: Re: [perfmon2] About per-thread monitoring > > > Hi Tanima, > > > > Does the " fprintf(stdout, "apptid %d gettid(): %d \n",apptid, > > gettid());" at line 136 print correct looking task ids? If the > > apptid is zero, maybe you need to add a "volatile" keyword added to > > the declaration of apptid, since it is written in one thread, and > > accessed in another. > > > > If the apptid is ok looking, and you're getting operation not > > permitted, that's seems very odd. Ptrace ought to be able to attach > > to threads you have created. > > > > Otherwise, the code looks ok to me. Maybe Stephane has some ideas. > > > > Regards, > > > > - Corey > > > > Corey Ashford > > Software Engineer > > IBM Linux Technology Center, Linux Toolchain > > Beaverton, OR > > 503-578-3507 > > cjash...@us.ibm.com > > > > > > Tanima Dey <dey_tr...@yahoo.com> wrote on 07/20/2009 12:37:55 PM: > > > > > Tanima Dey <dey_tr...@yahoo.com> > > > 07/20/2009 12:37 PM > > > > > > To > > > > > > Corey J Ashford/Beaverton/i...@ibmus > > > > > > cc > > > > > > Corey Ashford <cjash...@linux.vnet.ibm.com>, Perfmon <perfmon2- > > > de...@lists.sourceforge.net> > > > > > > Subject > > > > > > Re: [perfmon2] About per-thread monitoring > > > > > > Hi, > > > I am attaching the code. > > > Thank you very much. > > > Tanima. > > > > > > From: Corey J Ashford <cjash...@us.ibm.com> > > > To: Tanima Dey <dey_tr...@yahoo.com> > > > Cc: Corey Ashford <cjash...@linux.vnet.ibm.com>; Perfmon <perfmon2- > > > de...@lists.sourceforge.net> > > > Sent: Saturday, July 18, 2009 10:26:11 PM > > > Subject: Re: [perfmon2] About per-thread monitoring > > > > > 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 > > > [attachment "pstart7_8.c" deleted by Corey J Ashford/Beaverton/IBM] > > ------------------------------------------------------------------------------ > _______________________________________________ > perfmon2-devel mailing list > perfmon2-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/perfmon2-devel ------------------------------------------------------------------------------ _______________________________________________ perfmon2-devel mailing list perfmon2-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/perfmon2-devel