|
Replies:
3
-
Last Post:
May 9, 2008 4:37 PM
by: jhaslam
|
|
|
Adam Leventhal
ahl@eng.sun.com
|
|
|
|
recent USDT enhancements
Posted:
Feb 10, 2006 11:17 AM
|
|
DTracers,
I recently made a couple of enhancements to USDT that may have gone unnoticed.
User-land statically defined tracing (USDT) is the mechanism which allows developers to insert stable probes into their code. While applications can already be examined with the pid provider, USDT probes allow developers to expose stable abstractions and provide comprehensible insight into applications or dynamic language run-times. For more information on USDT check out these sites:
http://blogs.sun.com/roller/page/barts?entry=putting_user_defined_dtrace_probe http://docs.sun.com/app/docs/doc/817-6223/6mlkidlms?a=view
6370454 dtrace should support USDT probes in static functions
Before this bug was fixed in build 32, functions containing USDT probes could not be locally scoped (static). Putting a USDT probe in a static function would result in a (often incomprehensible) linker error when trying to link the final binary. Through some rather complex machinations, that's no longer the case.
6309681 USDT headergen
This fix in build 34 (available soon) adds a new -h option to the dtrace(1M) command that produces a header file containing declarations for your USDT probes. This simplifies use of USDT, makes it much easier to include USDT probes in a C++ binary, and allows us to use the compiler to perform some type checking.
Here's a comparison between the old and new USDT mechanisms (note that the old mechanism continues to work). This assumes you're building an application called 'program' from source called 'program.c' and your probes are defined in a file called 'myprovider.d'.
Old way: ---8<--- program.c ---8<---
#include <sys/s
void go(void) { ... DTRACE_PROBE3(myprovider, myprobe, arg1, arg2, arg3); ... }
---8<--- program.c ---8<---
cc -c program.c # produces program.o dtrace -G -s myprovider.d program.o # produces myprovider.o cc -o program program.o myprovider.o
New way: ---8<--- program.c ---8<---
#include "myprovider.h"
void go(void) { ... MYPROVIDER_MYPROBE(arg1, arg2, arg3); ... }
---8<--- program.c ---8<---
dtrace -h -s myprovider.d # produces myprovider.h cc -c program.c # produces program.o dtrace -G -s myprovider.d program.o # produces myprovider.o cc -o program program.o myprovider.o
If you have any questions or issues with either, please let me know.
Adam
-- Adam Leventhal, Solaris Kernel Development http://blogs.sun.com/ahl _______________________________________________ dtrace-discuss mailing list dtrace-discuss at opensolaris dot org
|
|
|
Posts:
31
From:
Registered:
4/10/07
|
|
|
|
Re: recent USDT enhancements
Posted:
May 9, 2008 2:46 PM
in response to: Adam Leventhal
|
|
Hi, Adam,
Is there any patch for sol10 for the bug#6370454(support USDT probes in static functions)?
Thanks,
Luojia(Jenny) Chen Software Engineer ISV Engineering v-mail:(510) 550-2394 SUN Microsystems
----- Original Message ----- From: Adam Leventhal <ahl at eng dot sun dot com> Date: Friday, February 10, 2006 11:19 am Subject: [dtrace-discuss] recent USDT enhancements To: dtrace-discuss at opensolaris dot org
> DTracers, > > I recently made a couple of enhancements to USDT that may have gone > unnoticed. > > User-land statically defined tracing (USDT) is the mechanism which allows > developers to insert stable probes into their code. While > applications can > already be examined with the pid provider, USDT probes allow > developers to > expose stable abstractions and provide comprehensible insight into > applications or dynamic language run-times. For more information on USDT > check out these sites: > > http://blogs.sun.com/roller/page/barts?entry=putting_user_defined_dtrace_probe > http://docs.sun.com/app/docs/doc/817-6223/6mlkidlms?a=view > > > 6370454 dtrace should support USDT probes in static functions > > Before this bug was fixed in build 32, functions containing USDT probes > could not be locally scoped (static). Putting a USDT probe in a static > function would result in a (often incomprehensible) linker error when > trying to link the final binary. Through some rather complex machinations, > that's no longer the case. > > > 6309681 USDT headergen > > This fix in build 34 (available soon) adds a new -h option to the dtrace(1M) > command that produces a header file containing declarations for your > USDT probes. This simplifies use of USDT, makes it much easier to include > USDT probes in a C++ binary, and allows us to use the compiler to perform > some type checking. > > Here's a comparison between the old and new USDT mechanisms (note > that the > old mechanism continues to work). This assumes you're building an application > called 'program' from source called 'program.c' and your probes are defined > in a file called 'myprovider.d'. > > Old way: > ---8<--- program.c ---8<--- > > #include <sys/s > > void go(void) { > ... > DTRACE_PROBE3(myprovider, myprobe, arg1, arg2, arg3); > ... > } > > ---8<--- program.c ---8<--- > > cc -c program.c # produces program.o > dtrace -G -s myprovider.d program.o # produces myprovider.o > cc -o program program.o myprovider.o > > New way: > ---8<--- program.c ---8<--- > > #include "myprovider.h" > > void go(void) { > ... > MYPROVIDER_MYPROBE(arg1, arg2, arg3); > ... > } > > ---8<--- program.c ---8<--- > > dtrace -h -s myprovider.d # produces myprovider.h > cc -c program.c # produces program.o > dtrace -G -s myprovider.d program.o # produces myprovider.o > cc -o program program.o myprovider.o > > > If you have any questions or issues with either, please let me know. > > Adam > > -- > Adam Leventhal, Solaris Kernel Development http://blogs.sun.com/ahl > _______________________________________________ > dtrace-discuss mailing list > dtrace-discuss at opensolaris dot org > _______________________________________________ dtrace-discuss mailing list dtrace-discuss at opensolaris dot org
|
|
|
|
Adam Leventhal
ahl@eng.sun.com
|
|
|
|
Re: recent USDT enhancements
Posted:
May 9, 2008 4:35 PM
in response to: jennyc
|
|
I'd suggest you check sunsolve.
Adam
On Fri, May 09, 2008 at 02:46:39PM -0700, Luojia Chen wrote: > Hi, Adam, > > Is there any patch for sol10 for the bug#6370454(support USDT probes in static functions)? > > > Thanks, > > Luojia(Jenny) Chen > Software Engineer > ISV Engineering > v-mail:(510) 550-2394 > SUN Microsystems > > ----- Original Message ----- > From: Adam Leventhal <ahl at eng dot sun dot com> > Date: Friday, February 10, 2006 11:19 am > Subject: [dtrace-discuss] recent USDT enhancements > To: dtrace-discuss at opensolaris dot org > > > > DTracers, > > > > I recently made a couple of enhancements to USDT that may have gone > > unnoticed. > > > > User-land statically defined tracing (USDT) is the mechanism which allows > > developers to insert stable probes into their code. While > > applications can > > already be examined with the pid provider, USDT probes allow > > developers to > > expose stable abstractions and provide comprehensible insight into > > applications or dynamic language run-times. For more information on USDT > > check out these sites: > > > > http://blogs.sun.com/roller/page/barts?entry=putting_user_defined_dtrace_probe > > http://docs.sun.com/app/docs/doc/817-6223/6mlkidlms?a=view > > > > > > 6370454 dtrace should support USDT probes in static functions > > > > Before this bug was fixed in build 32, functions containing USDT probes > > could not be locally scoped (static). Putting a USDT probe in a static > > function would result in a (often incomprehensible) linker error when > > trying to link the final binary. Through some rather complex machinations, > > that's no longer the case. > > > > > > 6309681 USDT headergen > > > > This fix in build 34 (available soon) adds a new -h option to the dtrace(1M) > > command that produces a header file containing declarations for your > > USDT probes. This simplifies use of USDT, makes it much easier to include > > USDT probes in a C++ binary, and allows us to use the compiler to perform > > some type checking. > > > > Here's a comparison between the old and new USDT mechanisms (note > > that the > > old mechanism continues to work). This assumes you're building an application > > called 'program' from source called 'program.c' and your probes are defined > > in a file called 'myprovider.d'. > > > > Old way: > > ---8<--- program.c ---8<--- > > > > #include <sys/s > > > > void go(void) { > > ... > > DTRACE_PROBE3(myprovider, myprobe, arg1, arg2, arg3); > > ... > > } > > > > ---8<--- program.c ---8<--- > > > > cc -c program.c # produces program.o > > dtrace -G -s myprovider.d program.o # produces myprovider.o > > cc -o program program.o myprovider.o > > > > New way: > > ---8<--- program.c ---8<--- > > > > #include "myprovider.h" > > > > void go(void) { > > ... > > MYPROVIDER_MYPROBE(arg1, arg2, arg3); > > ... > > } > > > > ---8<--- program.c ---8<--- > > > > dtrace -h -s myprovider.d # produces myprovider.h > > cc -c program.c # produces program.o > > dtrace -G -s myprovider.d program.o # produces myprovider.o > > cc -o program program.o myprovider.o > > > > > > If you have any questions or issues with either, please let me know. > > > > Adam > > > > -- > > Adam Leventhal, Solaris Kernel Development http://blogs.sun.com/ahl > > _______________________________________________ > > dtrace-discuss mailing list > > dtrace-discuss at opensolaris dot org > >
-- Adam Leventhal, Fishworks http://blogs.sun.com/ahl _______________________________________________ dtrace-discuss mailing list dtrace-discuss at opensolaris dot org
|
|
|
|
Posts:
172
From:
GB
Registered:
4/27/05
|
|
|
|
Re: recent USDT enhancements
Posted:
May 9, 2008 4:37 PM
in response to: jennyc
|
|
Hi Jenny,
By the looks of it this fix went into the Solaris 10 KU patch - at least I can see it in 120011-14 which was released in Sep 2007. No idea what the current KU patch is though.
Jon.
> Hi, Adam, > > Is there any patch for sol10 for the bug#6370454(support USDT probes in static functions)? > > > Thanks, > > Luojia(Jenny) Chen > Software Engineer > ISV Engineering > v-mail:(510) 550-2394 > SUN Microsystems > > ----- Original Message ----- > From: Adam Leventhal <ahl at eng dot sun dot com> > Date: Friday, February 10, 2006 11:19 am > Subject: [dtrace-discuss] recent USDT enhancements > To: dtrace-discuss at opensolaris dot org > > > >> DTracers, >> >> I recently made a couple of enhancements to USDT that may have gone >> unnoticed. >> >> User-land statically defined tracing (USDT) is the mechanism which allows >> developers to insert stable probes into their code. While >> applications can >> already be examined with the pid provider, USDT probes allow >> developers to >> expose stable abstractions and provide comprehensible insight into >> applications or dynamic language run-times. For more information on USDT >> check out these sites: >> >> http://blogs.sun.com/roller/page/barts?entry=putting_user_defined_dtrace_probe >> http://docs.sun.com/app/docs/doc/817-6223/6mlkidlms?a=view >> >> >> 6370454 dtrace should support USDT probes in static functions >> >> Before this bug was fixed in build 32, functions containing USDT probes >> could not be locally scoped (static). Putting a USDT probe in a static >> function would result in a (often incomprehensible) linker error when >> trying to link the final binary. Through some rather complex machinations, >> that's no longer the case. >> >> >> 6309681 USDT headergen >> >> This fix in build 34 (available soon) adds a new -h option to the dtrace(1M) >> command that produces a header file containing declarations for your >> USDT probes. This simplifies use of USDT, makes it much easier to include >> USDT probes in a C++ binary, and allows us to use the compiler to perform >> some type checking. >> >> Here's a comparison between the old and new USDT mechanisms (note >> that the >> old mechanism continues to work). This assumes you're building an application >> called 'program' from source called 'program.c' and your probes are defined >> in a file called 'myprovider.d'. >> >> Old way: >> ---8<--- program.c ---8<--- >> >> #include <sys/s >> >> void go(void) { >> ... >> DTRACE_PROBE3(myprovider, myprobe, arg1, arg2, arg3); >> ... >> } >> >> ---8<--- program.c ---8<--- >> >> cc -c program.c # produces program.o >> dtrace -G -s myprovider.d program.o # produces myprovider.o >> cc -o program program.o myprovider.o >> >> New way: >> ---8<--- program.c ---8<--- >> >> #include "myprovider.h" >> >> void go(void) { >> ... >> MYPROVIDER_MYPROBE(arg1, arg2, arg3); >> ... >> } >> >> ---8<--- program.c ---8<--- >> >> dtrace -h -s myprovider.d # produces myprovider.h >> cc -c program.c # produces program.o >> dtrace -G -s myprovider.d program.o # produces myprovider.o >> cc -o program program.o myprovider.o >> >> >> If you have any questions or issues with either, please let me know. >> >> Adam >> >> -- >> Adam Leventhal, Solaris Kernel Development http://blogs.sun.com/ahl >> _______________________________________________ >> dtrace-discuss mailing list >> dtrace-discuss at opensolaris dot org >> >> > _______________________________________________ > dtrace-discuss mailing list > dtrace-discuss at opensolaris dot org >
_______________________________________________ dtrace-discuss mailing list dtrace-discuss at opensolaris dot org
|
|
|
|
|