Hillel (Sabba) Markowitz
2009-Dec-08 20:20 UTC
[dtrace-discuss] Use of -Z in setting up a dtrace script
I have an application that generates threads during the process. I
start it with
pid$target:Base::entry
{
put code here
}
pid$target:Thread1::entry
{
put code here
}
This will be started with "script.d -c "Base args"
This does not work because Thread1 has not yet been started. It will
succeed if I make the first line of the script
#!/usr/sbin/dtrace -Z -s
but there will be no output from the code.
On the other hand, if I just have the Base code, but do not have -Z,
the statistics will appear, but only for Base.
How do I see the Thread1 statistics
--
Sabba - ??? ??? - Hillel
Hillel (Sabba) Markowitz | Said the fox to the fish, "Join me ashore"
SabbaHillel at gmail.com | The fish are the Jews, Torah is our water
http://photos1.blogger.com/blogger/7637/544/640/SabbaHillel.jpg
Angelo Rajadurai
2009-Dec-08 20:25 UTC
[dtrace-discuss] Use of -Z in setting up a dtrace script
Hi Hillel:
The second tuple in the pid probe definition is for the name of the library and
not the threadId.
You can do what want by using a predicate.
pid$target:a.out::entry
/tid=3/
{
put code here
}
HTHs
Angelo
On Dec 8, 2009, at 3:20 PM, Hillel (Sabba) Markowitz wrote:
> I have an application that generates threads during the process. I
> start it with
>
> pid$target:Base::entry
> {
> put code here
> }
>
> pid$target:Thread1::entry
> {
> put code here
> }
>
>
> This will be started with "script.d -c "Base args"
>
> This does not work because Thread1 has not yet been started. It will
> succeed if I make the first line of the script
>
> #!/usr/sbin/dtrace -Z -s
>
> but there will be no output from the code.
>
> On the other hand, if I just have the Base code, but do not have -Z,
> the statistics will appear, but only for Base.
>
> How do I see the Thread1 statistics
>
>
> --
> Sabba - ??? ??? - Hillel
> Hillel (Sabba) Markowitz | Said the fox to the fish, "Join me
ashore"
> SabbaHillel at gmail.com | The fish are the Jews, Torah is our water
> http://photos1.blogger.com/blogger/7637/544/640/SabbaHillel.jpg
> _______________________________________________
> dtrace-discuss mailing list
> dtrace-discuss at opensolaris.org
Hillel (Sabba) Markowitz
2009-Dec-08 20:58 UTC
[dtrace-discuss] Use of -Z in setting up a dtrace script
On Tue, Dec 8, 2009 at 3:25 PM, Angelo Rajadurai <Angelo.Rajadurai at sun.com> wrote:> Hi Hillel: > > The second tuple in the pid ?probe definition is for the name of the library and not the threadId. > > You can do what want by using a predicate. > > pid$target:Base::entry > /tid=3/ > { > ? ? ? ?put code here > } > > HTHs > > AngeloSince I do not know the thread id, but the library or thread name is known, how would I do it? For example, the main executable is Base, it is built with various libraries such as gcc -g Base.c -o Base -l Thread1 -l Thread2 -l Thread3 (which are all .so and used dynamically when the thread is needed). When I set up the script as you showed it above, I do not get the Threadn lists referring to probefunc that are called from within Threadn. A trivial hello world type test that does not use threads will allow pid$target:hello::entry { code } pid$target:libc::entry { code } -- Sabba - ??? ??? - Hillel Hillel (Sabba) Markowitz | Said the fox to the fish, "Join me ashore" SabbaHillel at gmail.com | The fish are the Jews, Torah is our water http://photos1.blogger.com/blogger/7637/544/640/SabbaHillel.jpg
Angelo Rajadurai
2009-Dec-09 14:15 UTC
[dtrace-discuss] Use of -Z in setting up a dtrace script
Hi Hillel:
Just want to clarify the terminologies here. What you have here is dynamic
libraries and not threads.
Try
pid$target:*Thread1*::entry
{
put your code here
}
See if this works. You do not need to use the -Z.
-Angelo
On Dec 8, 2009, at 3:58 PM, Hillel (Sabba) Markowitz wrote:
> On Tue, Dec 8, 2009 at 3:25 PM, Angelo Rajadurai
> <Angelo.Rajadurai at sun.com> wrote:
>> Hi Hillel:
>>
>> The second tuple in the pid probe definition is for the name of the
library and not the threadId.
>>
>> You can do what want by using a predicate.
>>
>> pid$target:Base::entry
>> /tid=3/
>> {
>> put code here
>> }
>>
>> HTHs
>>
>> Angelo
>
> Since I do not know the thread id, but the library or thread name is
> known, how would I do it?
>
> For example, the main executable is Base, it is built with various
> libraries such as
>
> gcc -g Base.c -o Base -l Thread1 -l Thread2 -l Thread3 (which are all
> .so and used dynamically when the thread is needed).
>
> When I set up the script as you showed it above, I do not get the
> Threadn lists referring to probefunc that are called from within
> Threadn.
>
> A trivial hello world type test that does not use threads will allow
>
> pid$target:hello::entry
> {
> code
> }
>
> pid$target:libc::entry
> {
> code
> }
>
>
>
>
> --
> Sabba - ??? ??? - Hillel
> Hillel (Sabba) Markowitz | Said the fox to the fish, "Join me
ashore"
> SabbaHillel at gmail.com | The fish are the Jews, Torah is our water
> http://photos1.blogger.com/blogger/7637/544/640/SabbaHillel.jpg
Hillel (Sabba) Markowitz
2009-Dec-09 15:57 UTC
[dtrace-discuss] Use of -Z in setting up a dtrace script
On Wed, Dec 9, 2009 at 9:15 AM, Angelo Rajadurai <Angelo.Rajadurai at sun.com> wrote:> Hi Hillel: > > Just want to clarify the terminologies here. What you have here is dynamic libraries and not threads. > > Try > > pid$target:*Thread1*::entry > { > ? ? ? ?put your code here > } > > See if this works. You do not need to use the -Z. > > -AngeloThanks. I got confused between threads and dynamic modules. It actually turns out that if I put the "-Z'' in the script as #!/usr/sbin/dtrace -Z -s There is no output. On the other hand, if I set it up as #!/usr/sbin/dtrace -s and call it with script.d -Z -c "Base <args>" I will then see the output. I will use this to try to get the setup to work. -- Sabba - ??? ??? - Hillel Hillel (Sabba) Markowitz | Said the fox to the fish, "Join me ashore" SabbaHillel at gmail.com | The fish are the Jews, Torah is our water http://photos1.blogger.com/blogger/7637/544/640/SabbaHillel.jpg
Adam Leventhal
2009-Dec-09 19:49 UTC
[dtrace-discuss] Use of -Z in setting up a dtrace script
> Thanks. I got confused between threads and dynamic modules. It > actually turns out that if I put the "-Z'' in the script as > > #!/usr/sbin/dtrace -Z -s > > There is no output. On the other hand, if I set it up as > > #!/usr/sbin/dtrace -sRemember that shell scripts can provide at most one option after the #! syntax. Also note that -Z should only be used if its known that the probes specified will show up at some later time -- otherwise you''ll never see any output. Adam -- Adam Leventhal, Fishworks http://blogs.sun.com/ahl