Hello,

On Fri, Sep 5, 2008 at 1:41 PM, Andrej van der Zee
<[EMAIL PROTECTED]> wrote:
> Hi,
>
> I have a multi-threaded application that handles external requests in
> threads (one request per thread) running on Linux. In this
> request-handler thread it *may* fork, and its child process may fork
> again, and.... I was wondering if it is possible to read the counters
> of the thread and all the forked children in the request handler
> thread. In other words, can I do this without touching the source code
> of the forked childs?
>
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.

-------------------------------------------------------------------------
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