Hi, On Thu, Jul 16, 2009 at 6:24 PM, Tanima Dey<dey_tr...@yahoo.com> wrote: > Hi, > I am trying to read the performance counters for the per-thread non-self > monitoring session. There will be two threads, application and the monitor > thread. The application will be running itself and the monitor thread will > read the counters only for the application thread. I am trying to load the > context of the application thread in the monitor thread but getting error > messages. The code is something in the monitor thread: > ov->load_arg.load_pid = apptid; > > if (pfm_load_context(fd, &ov->load_arg) != 0) > errx(1, "pfm_load_context failed"); > > Is it not allowed? > I have looked into couple of examples in the examples.v2_x directory, they > are similar, but those are for tasks or separate processes, but not for > threads. I got from the manuals that the for the per-thread non-self > monitoring session, the thread must be stopped via ptrace call when I want > to attach or read the counts, but ptrace is used only to stop a process, but > not a specific thread. > > Can you help?
You can attach to specific threads with ptrace, just pass the TID (gettid()) instead of PID. The use of ptrace is an implementation constraint which I am planning on dropping in the next release of perfmon for 2.6.30. Sorry about that. ------------------------------------------------------------------------------ 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