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?
Regards
Tanima.
________________________________
From: stephane eranian <eran...@googlemail.com>
To: Tanima Dey <dey_tr...@yahoo.com>
Cc: Perfmon <perfmon2-devel@lists.sourceforge.net>
Sent: Thursday, July 16, 2009 3:08:22 PM
Subject: Re: [perfmon2] About per-thread monitoring
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.
Hi,
------------------------------------------------------------------------------
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