This is the mail archive of the systemtap@sourceware.org mailing list for the systemtap project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug runtime/13017] process().attach/detach probe


http://sourceware.org/bugzilla/show_bug.cgi?id=13017

David Smith <dsmith at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dsmith at redhat dot com

--- Comment #1 from David Smith <dsmith at redhat dot com> 2011-07-22 14:25:44 UTC ---
(In reply to comment #0)
> Sometimes it is useful to be able to see which processes staps vma tracker will
> be monitoring. Just so you know whether or not you can expect any other probe
> triggers.
> 
> The use case would be with processes that are mostly idle. So you might run a
> script like:
> 
> probe process("lazy_daemon").function("*") { printf("%d: %s\n", pid(), pp()) }
> 
> But now you don't get any feedback if the lazy_daemon is just sleeping.
> 
> So you would like to add something like:
> 
> probe process("lazy_daemon").attach { printf("monitoring %d\n", pid()) }
> probe process("lazy_daemon").detach { printf("%d is gone\n", pid()) }
> 
> These should just trigger when the stap runtime vma tracker
> registers/deregisters a process.

The process("lazy_daemon").{begin,end} probes fire at 2 times:

1) When lazy_daemon starts/ends.
2) If lazy_daemon is running (or sleeping) when the systemtap script starts,
the begin probe will fire the next time lazy_daemon stops (job control, syscall
entry/exit, etc.).

If you look in __stp_utrace_task_finder_target_quiesce(), you'll see the
following:

        /* Call the callbacks.  Assume that if the thread is a                  
         * thread group leader, it is a process. */                             
        __stp_call_callbacks(tgt, tsk, 1, (tsk->pid == tsk->tgid));             

        /* If this is just a thread other than the thread group leader,         
           don't bother inform map callback clients about its memory map,       
           since they will simply duplicate each other. */                      
        if (tgt->mmap_events == 1 && tsk->tgid == tsk->pid) {                   
                __stp_call_mmap_callbacks_for_task(tgt, tsk);                   
        }                                                                       

That 1st function calls any begin probes.  The 2nd calls the vma tracer stuff.

Does .begin not already do what you want?

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]