Hello, The conditional "trick" of: condition ? printf(...) : 1; (where condition is an inline known at compile-time) is extensively used in the DTrace ToolKit (see for example dapptrace).
Now, as far as I have been able to find, this is explicitly documented as impossible: "The second and third expressions [of the conditional] also may not invoke a tracing function such as trace or printf.", as seen in https://docs.oracle.com/cd/E23824_01/html/E22973/typopexp.html#glgdp . Also I have seen some threads back in the list, around 2009, discussing if/then/else alternatives, but this construction doesn't seem to have been mentioned. I'd guess that it's working because of the compile-time inline being treated as a constant and compiled away. But... is that it / is that all? Or am I missing something? Also, this style of conditional execution is much more compact than using predicates and small action blocks. Should I consider any disadvantage? Performance maybe? And speaking of performance: I've read about cacheable predicates in the Oracle guide and about clausule and thread variables vs globals and arrays. Is there anything else to be aware of? Or, any way in which I could check myself the performance characteristics of my DTrace programs - as in the case of the conditional "trick" vs multiple predicate/action blocks? --- Horacio ------------------------------------------- dtrace-discuss Archives: https://www.listbox.com/member/archive/184261/=now RSS Feed: https://www.listbox.com/member/archive/rss/184261/25769126-e243886f Modify Your Subscription: https://www.listbox.com/member/?member_id=25769126&id_secret=25769126-8d47a7b2 Powered by Listbox: http://www.listbox.com