Francois Dion
2007-Apr-10 16:14 UTC
[dtrace-discuss] using pid provider with short lived process?
I''d like to gather info on time spent in user functions and number of calls to these in a short lived process (2 seconds at most). It doesn''t run long enough to grab a pid and pass it to a dtrace script, but it does have a unique execname. I can thus throw away with a execname=predicate on certain providers, but I haven''t figured a way to use the PID provider if I dont know the process id since the process will run after the dtrace script is started... Ideally, I''d like to drill down into libclntsh.so (oracle 10g client lib), but if I can at least get a feel for what is happening in the app that is linked to libclntsh... Any suggestions? Thanks.
Chip Bennett
2007-Apr-10 17:09 UTC
[dtrace-discuss] using pid provider with short lived process?
As I see it, you have two problems: having the PID for for the pid provider, yes, but also, getting the probes established and the D program compiled before the process is over, and there''s no data left to collect. I think you''ll need to inject DTrace into the execution start process. Either find where the program is invoked and replace it with a DTrace invocation, or change the PATH order so that your own version of the executable is found first (the one that invokes DTrace with the real executable). Chip Francois Dion wrote:> I''d like to gather info on time spent in user functions and number of > calls to these in a short lived process (2 seconds at most). It doesn''t > run long enough to grab a pid and pass it to a dtrace script, but it > does have a unique execname. I can thus throw away with a execname=> predicate on certain providers, but I haven''t figured a way to use the > PID provider if I dont know the process id since the process will run > after the dtrace script is started... > > Ideally, I''d like to drill down into libclntsh.so (oracle 10g client > lib), but if I can at least get a feel for what is happening in the app > that is linked to libclntsh... > > Any suggestions? > > Thanks. > _______________________________________________ > dtrace-discuss mailing list > dtrace-discuss at opensolaris.org >
Nicolas Williams
2007-Apr-10 17:29 UTC
[dtrace-discuss] using pid provider with short lived process?
On Tue, Apr 10, 2007 at 12:09:07PM -0500, Chip Bennett wrote:> As I see it, you have two problems: having the PID for for the pid > provider, yes, but also, getting the probes established and the D > program compiled before the process is over, and there''s no data left to > collect. > > I think you''ll need to inject DTrace into the execution start process. > [...]The way I''ve done this in the past is by stopping the victim process as it gets started using proc or syscall provider probes and the stop() destructive action, then firing off a new dtrace instance (with system()) to establish the pid provider probes for the victim and prun it (with system(), from a BEGIN clause). With the Java APIs you might be able to do all that without having to fork()/exec() anything. Nico --