Hi,

On Mon, Sep 8, 2008 at 11:43 PM, Andrej van der Zee
<[EMAIL PROTECTED]> wrote:
> Hi,
>
>> You certainly don't need to modify the code of the child processes.
>> In the handler you can read the counter of the child processes. But
>> for the read to succeed, you need to stop the child. This can currently
>> be accomplished using ptrace and in particular PTRACE_ATTACH.
>> So you issue this call, wait (WUNTRACED) until this is effective, then you
>> call pfm_read_pmds(). When you are done, simply PTRACE_DETACH
>> the child.
>>
>
> Thanks.
>
> I guess the pfmon source code for the --follow-all option is a good
> example. The problem is that in my case I cannot stop the child with
> ptrace() because the handler-thread forks in a hook-method that is not
> implemented by me. So I have no access to the child.
>
To operate on a thread, and especially its machine state which the PMU
is a part of, it
needs to be stopped. Ptrace is the mechanism we currently use until
utrace gets into
the kernel.

> Another option that I though of is to attach to the *thread* after it
> is created and then implement pfmon's --follow-all option. But I guess
> attach() does not work for threads, right?
>
I think it does work. With pfmon for instance, with the --attach-task,
you can specify
a thread id and not just a process id.

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
perfmon2-devel mailing list
perfmon2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/perfmon2-devel

Reply via email to