Am I correct in assuming that signedness is lost in DTRACE_PROBE<n>? avg just isn''t working right, and in looking at the definition: #define DTRACE_PROBE1(name, type1, arg1) { \ extern void __dtrace_probe_##name(uintptr_t); \ __dtrace_probe_##name((uintptr_t)(arg1)); \ } it sorta looks like type1 isn''t very influential... Mostly this is ignorable except for aggregations, I guess. Has this come up before? (If I aggregate with avg, and have negative numbers, the aggregation results are huge positive numbers)
Hey Dan, Keep in mind that the arg0..arg9 variables are always unsigned 64 integers. If you want the typed version, use args[N]. If you''re defining you own SDT probes, you can specify the types in usr/src/uts/common/dtrace/sdt_subr.c. We''ve talked about unifying USDT and SDT so they''d both use the same mechanism (which includes typed arguments), but that''s a long way off. Adam On Thu, May 04, 2006 at 06:35:02PM -0700, Dan Mick wrote:> Am I correct in assuming that signedness is lost in DTRACE_PROBE<n>? avg > just > isn''t working right, and in looking at the definition: > > #define DTRACE_PROBE1(name, type1, arg1) { \ > extern void __dtrace_probe_##name(uintptr_t); \ > __dtrace_probe_##name((uintptr_t)(arg1)); \ > } > > it sorta looks like type1 isn''t very influential... > > Mostly this is ignorable except for aggregations, I guess. Has this come up > before? > > (If I aggregate with avg, and have negative numbers, the aggregation > results are > huge positive numbers) > > _______________________________________________ > dtrace-discuss mailing list > dtrace-discuss at opensolaris.org-- Adam Leventhal, Solaris Kernel Development http://blogs.sun.com/ahl
Adam Leventhal wrote:> Hey Dan, > > Keep in mind that the arg0..arg9 variables are always unsigned 64 integers. > If you want the typed version, use args[N]. If you''re defining you own SDT > probes, you can specify the types in usr/src/uts/common/dtrace/sdt_subr.c.Ah, if I want to go the full distance and be a "SDT named provider". Yeah, I was just sprinklin'' probes in the kernel source. I guess the way to get signedness, then, is to become known to sdt as a full-fledged guy. but it seems like one can''t use the short trick of DTRACE_PROBE<n> with any type but uintptr_t-sized-and-signedness....correct? (I wasn''t sure if you were confirming or denying; I don''t think using args[0] would make any difference here, would it?)> We''ve talked about unifying USDT and SDT so they''d both use the same > mechanism (which includes typed arguments), but that''s a long way off. > > Adam > > On Thu, May 04, 2006 at 06:35:02PM -0700, Dan Mick wrote: > >>Am I correct in assuming that signedness is lost in DTRACE_PROBE<n>? avg >>just >>isn''t working right, and in looking at the definition: >> >>#define DTRACE_PROBE1(name, type1, arg1) { \ >> extern void __dtrace_probe_##name(uintptr_t); \ >> __dtrace_probe_##name((uintptr_t)(arg1)); \ >>} >> >>it sorta looks like type1 isn''t very influential... >> >>Mostly this is ignorable except for aggregations, I guess. Has this come up >>before? >> >>(If I aggregate with avg, and have negative numbers, the aggregation >>results are >>huge positive numbers) >> >>_______________________________________________ >>dtrace-discuss mailing list >>dtrace-discuss at opensolaris.org > >
> Adam Leventhal wrote: > > Hey Dan, > > > > Keep in mind that the arg0..arg9 variables are always unsigned 64 integers. > > If you want the typed version, use args[N]. If you''re defining you own SDT > > probes, you can specify the types in usr/src/uts/common/dtrace/sdt_subr.c. > > Ah, if I want to go the full distance and be a "SDT named provider". Yeah, I > was just sprinklin'' probes in the kernel source. I guess the way to get > signedness, then, is to become known to sdt as a full-fledged guy. > > but it seems like one can''t use the short trick of DTRACE_PROBE<n> with any type > but uintptr_t-sized-and-signedness....correct? (I wasn''t sure if you were > confirming or denying; I don''t think using args[0] would make any difference > here, would it?)If you use DTRACE_PROBE<n>, then your probe is generically published under the provider whose name is "sdt". The arguments for "sdt" are only available using the raw arg0-argN variables, whose type is an integer and whose value is the ISA-word-sized value found in the corresponding ABI register or stack location. No typed arguments (args[]) are available for these probes. If you use the SDT *mechanism* (as opposed to the provider named "sdt") you can define a customized provider and customized argument types in sdt_subr.c as Adam mentioned. In this case, your arguments will be passed back to DTrace as ISA-word-sized uintptr_t''s, but the types will be associated with the args[] array and DTrace will convert them to the appropriate type when they are referenced during the execution of the D program in the kernel. You can view the probe argument types, if any, by uttering: $ dtrace -lvP <provider> ... to list all probes and types for the <provider> $ dtrace -lvn <name> ... to list the types for probe <name> $ dtrace -lvs <script> ... to list the types for the probes in the <script> -Mike -- Mike Shapiro, Solaris Kernel Development. blogs.sun.com/mws/
On Fri, May 05, 2006 at 06:22:48PM -0700, Dan Mick wrote:> but it seems like one can''t use the short trick of DTRACE_PROBE<n> with any > type but uintptr_t-sized-and-signedness....correct? (I wasn''t sure if you > were confirming or denying; I don''t think using args[0] would make any > difference here, would it?)Correct. If you have a signed value, you''ll need to cast the uintptr_t back to a signed int (or whatever) in your DTrace program. Adam -- Adam Leventhal, Solaris Kernel Development http://blogs.sun.com/ahl