Chad Mynhier wrote:
On Sun, Sep 13, 2009 at 4:54 PM, Yossi Lev (Sun Labs) <yosef....@sun.com> wrote:
My questions:

- If not, do you have any other idea how can I achieve this kind of
 dynamically adapting tracing behavior?

For something this complicated, you might want to look at writing your
own DTrace consumer.

I assume that by that you mean programming directly to the libdtrace library --- the one whose interface is said not to be public and undocumented --- right? I saw warnings in various websites regarding programming to this interface, especially because it is not public and might change in future releases. Is that still true?

In any case, I would love it if you can send me your notes on it...

There isn't really any good documentation on
this, but I have some notes written up if you're interested.  I don't
know that it would be any easier doing this within a D script, if you
could even figure out how to do what you want.  But if you write a
custom DTrace consumer, you could get access to the data without
having to play games with catching the output of dtrace(1M).

Well, accessing the data is not really the problem. I'm using the DTrace Java API, that allows you (I think) to take snapshots of aggregation while the DTrace script is running. The problem is putting this data back in predicates --- once I started running a script, I cannot modify it, so even though I can get the information of what event types needed to be monitored, I cannot make the script monitor them for me. This is why I suggested generating another script, and running it in parallel.

Do you think that the two scripts solution should work? Here is the high level idea:

- A first script starts the program (with the -c switch), and has pid$target probes that copyout() some info to let the program know to start gathering and reporting basic information about all event types.

- A second script is generated based on the info gathered by the first (gathered by the Java DTrace API). This script has pic<x> probes (where x is the process id spawn by the first script), and executes some additional copyout() operations to notify the program which event types should be monitored in details.

Note that they both have to run destructive operations...

Thanks,
Yossi


Chad
_______________________________________________
dtrace-discuss mailing list
dtrace-discuss@opensolaris.org

Reply via email to