Kodnani_Mohnish at emc.com
2007-Apr-18 23:41 UTC
[dtrace-discuss] Tracing a process that is not created yet.
Hi , I have this problem , which might have been discussed here, but I am new to Dtrace and so apologies if this is not new. I have a C++ server which forks off a new process , on a connection. I want to trace certain functions in these new processes. So , I wrote a test script as follows : Proc:::create { self->trace = 1; } ::Mangled_Function_name:entry / self->trace == 1 && execname == "server" / { self->ts[probefunc] = timestamp; } ::Mangled_Function_name:return /self->trace == 1 && execname =="server / { printf(" Time taken %d", timestamp - self->ts[probefunc]); } When ever the server will create a new process it will enter , in the first probe for create. My questions : 1) First of all when I run the program with the command "dtrace -s trial.d" , it gives an error that the probe did not match for the Mangled_Function_Name. So , I used -Z option to make the program run. Is there any other way. 2) The newly created processes do not enter into the Mangled_Function_name probe. However, when I used the same Function and use it in a known pid this works. So , my question is why doesn''t Dtrace find a match in this newly created process. How do I achieve , this functionality . Thanks Mohnish Kodnani