Focus Of EnergyThe atoms bouncing in my head |
|
Friday Sep 07, 2007
A simple DTrace USDT example
When I started out trying to make a USDT for MPI I found I had to go around and look at several snippits and poke my eye with a stick several times before I got something at a basic level to work. So, I've decided to post a simple example of making a USDT that shows the code, compilation lines, D script and how to execute. I have a simple C program that will call a routine in a separate object. This object has a probe in it that I want to attach to later. The probe will take a string. The resulting code follows: ---------main.c------------ void main() { ---------debug.c------------ void To compile the program, separate object and provider you do the following in this order:
To use the probe: % dtrace -c main -n 'mpi__test$target::: { printf("here"); }'
Now to see the argument passed into the probe by the program: % dtrace -c main -n 'mpi__test$target::: { printf("%s", copyinstr(arg0)); }'
Posted at 09:33AM Sep 07, 2007 by Terry Dontje in DTrace | Comments[0] Comments:
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||