Caruana, Damien
2006-May-25 10:19 UTC
[dtrace-discuss] Does the use of predicates removes all performance impact?
Hi, I have been tought that if a probe is not enabled by a predicate, there was no performance impact by the use of the dtrace script. By reading some messages on this mailing list I saw that it is prehaps not exactly the case. Do you have some precision on what performance impact has a probe that is not enabled by a predicate and if it is the same thing or not that not defining at all the probe inside the script? Thank''s Damien -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.opensolaris.org/pipermail/dtrace-discuss/attachments/20060525/1b447826/attachment.html>
Jim Fiori
2006-May-25 14:11 UTC
[dtrace-discuss] Does the use of predicates removes all performance impact?
Caruana, Damien wrote:> > Hi, > > I have been tought that if a probe is not enabled by a predicate, there > was no performance impact by the use of the dtrace script.Not true. All probes when "fired" will execute DTrace code in the kernel. Any predicate expression evaluation must be performed at that time. If the expression is false, then there is no penalty for the action statements. So the performance impact is a function of how often the probe fires and how expensive the expression within the predicate is to execute. For example, string comparisons would be more expensive than thread-specific integer comparisons. Jim By reading> some messages on this mailing list I saw that it is prehaps not exactly > the case. > Do you have some precision on what performance impact has a probe that > is not enabled by a predicate and if it is the same thing or not that > not defining at all the probe inside the script? > Thank''s > > Damien > > > ------------------------------------------------------------------------ > > _______________________________________________ > dtrace-discuss mailing list > dtrace-discuss at opensolaris.org
Jonathan Adams
2006-May-25 22:24 UTC
[dtrace-discuss] Does the use of predicates removes all performance impact?
On Thu, May 25, 2006 at 10:11:17AM -0400, Jim Fiori wrote:> Caruana, Damien wrote: > > > >Hi, > > > >I have been tought that if a probe is not enabled by a predicate, there > >was no performance impact by the use of the dtrace script. > > Not true. All probes when "fired" will execute DTrace code in the kernel. > Any predicate expression evaluation must be performed at that time. If the > expression is false, then there is no penalty for the action statements. > > So the performance impact is a function of how often the probe fires and > how expensive the expression within the predicate is to execute. For > example, string comparisons would be more expensive than thread-specific > integer comparisons.In addition, certain predicates are "cacheable"; for these, much of the predicate evaluation is skipped. See the "Performance Considerations" chapter of the Dynamic Tracing Answerbook, in particular the "Use Cacheable Predicates" section. Cheers, - jonathan -- Jonathan Adams, Solaris Kernel Development
Caruana, Damien
2006-May-26 08:07 UTC
[dtrace-discuss] Does the use of predicates removes all performance impact?
If I well understood, If I defined a probe into my source code, each time my Dtrace probe will by met in my code, some dtrace code will be executed in the kernel even if I don''t use any Dtrace script. And using a script with a predicate will only add the penalty providing by the expression within the predicate. Right? Do you know what kind of action is done in the kernel each time a probe is fired? Damien -----Original Message----- From: Jim.Fiori at Sun.COM [mailto:Jim.Fiori at Sun.COM] Sent: jeudi 25 mai 2006 16:11 To: Caruana, Damien Cc: dtrace-discuss at opensolaris.org Subject: Re: [dtrace-discuss] Does the use of predicates removes all performance impact? Caruana, Damien wrote:> > Hi, > > I have been tought that if a probe is not enabled by a predicate,there> was no performance impact by the use of the dtrace script.Not true. All probes when "fired" will execute DTrace code in the kernel. Any predicate expression evaluation must be performed at that time. If the expression is false, then there is no penalty for the action statements. So the performance impact is a function of how often the probe fires and how expensive the expression within the predicate is to execute. For example, string comparisons would be more expensive than thread-specific integer comparisons. Jim By reading> some messages on this mailing list I saw that it is prehaps notexactly> the case. > Do you have some precision on what performance impact has a probe that> is not enabled by a predicate and if it is the same thing or not that > not defining at all the probe inside the script? > Thank''s > > Damien > > >------------------------------------------------------------------------> > _______________________________________________ > dtrace-discuss mailing list > dtrace-discuss at opensolaris.org
Michael Schuster
2006-May-26 08:33 UTC
[dtrace-discuss] Does the use of predicates removes all performance impact?
Caruana, Damien wrote:> If I well understood, > If I defined a probe into my source code, each time my Dtrace probe will > by met in my code, some dtrace code will be executed in the kernel even > if I don''t use any Dtrace script.no (according to my understanding). as long as you''re not tracing anything, there is NO impact. read again: NO impact. once you start tracing, the code at the point you''re watching is dynamically changed to - put very basically - branch to the DTrace-specific code. This code then evaluates any predicates. all this and tons more is documented on opensolaris.org - have fun! Michael -- Michael Schuster (+49 89) 46008-2974 / x62974 visit the online support center: http://www.sun.com/osc/ Recursion, n.: see ''Recursion''
Casper.Dik at Sun.COM
2006-May-26 08:45 UTC
[dtrace-discuss] Does the use of predicates removes all performance impact?
>Caruana, Damien wrote: >> If I well understood, >> If I defined a probe into my source code, each time my Dtrace probe will >> by met in my code, some dtrace code will be executed in the kernel even >> if I don''t use any Dtrace script. > >no (according to my understanding).The probe code is converted to nops. Which basically means there''s "next to no" impact but not exactly zero.>once you start tracing, the code at the point you''re watching is >dynamically changed to - put very basically - branch to the DTrace-specific >code. This code then evaluates any predicates.Yes, but for probe points, some instruction space is reserved. Casper
Caruana, Damien
2006-May-26 12:17 UTC
[dtrace-discuss] Does the use of predicates removes all performance impact?
I''d like to have a better understanding of the impact of using a predicate. I would like to enable a probe on certain condition. If I can check the condition inside my code before firing the probe or inside the predicate, with a basic string comparaison for example, what''s the best thing to do? - firing the probe all the time and using a predicate to generate traces or not, - or compare the string inside an ''if'' statement into my code to choose to fire the probe or not to generate traces? So does firing a probe and making a string comparaison inside a predicate is a better choice than doing the string comparaison into an ''if'' statement into my code to fire or not the probe? Thank''s -----Original Message----- From: casper at holland.sun.com [mailto:casper at holland.sun.com]On Behalf Of Casper.Dik at Sun.COM Sent: vendredi 26 mai 2006 10:45 To: Michael Schuster Cc: Caruana, Damien; Jim.Fiori at Sun.COM; dtrace-discuss at opensolaris.org Subject: Re: [dtrace-discuss] Does the use of predicates removes all performance impact?>Caruana, Damien wrote: >> If I well understood, >> If I defined a probe into my source code, each time my Dtrace probewill>> by met in my code, some dtrace code will be executed in the kerneleven>> if I don''t use any Dtrace script. > >no (according to my understanding).The probe code is converted to nops. Which basically means there''s "next to no" impact but not exactly zero.>once you start tracing, the code at the point you''re watching is >dynamically changed to - put very basically - branch to theDTrace-specific>code. This code then evaluates any predicates.Yes, but for probe points, some instruction space is reserved. Casper
Casper.Dik at Sun.COM
2006-May-26 12:26 UTC
[dtrace-discuss] Does the use of predicates removes all performance impact?
>I''d like to have a better understanding of the impact of using a >predicate.A predicate in a dtrace script you mean?>I would like to enable a probe on certain condition. If I can check the >condition inside my code before firing the probe or inside the >predicate, with a basic string comparaison for example, what''s the best >thing to do?If you have static probes, they cost next to nothing when dtrace is not using them, so there''s really no cost there. If you test a predicate in your code, then the cost of the test is always there, enabled or not: clearly that is a higher runtime penalty to pay. If you''re probing and using a predicate, then clearly the predicate will need to be evaluated each time. Casper
Roch Bourbonnais - Performance Engineering
2006-May-26 12:58 UTC
[dtrace-discuss] Does the use of predicates removes all performance impact?
Maybe we would need to have a highler level view of what your trying to acheive. We normally don''t have to focus that hard on the cost of predicate. I''m not saying the cost ain''t there, nor that it would be good to reduce it, but it''s mostly been more than acceptable for a lot of usecase. So why do you fear it that much and what are you trying to achieve here ? -r Caruana, Damien writes: > I''d like to have a better understanding of the impact of using a > predicate. > I would like to enable a probe on certain condition. If I can check the > condition inside my code before firing the probe or inside the > predicate, with a basic string comparaison for example, what''s the best > thing to do? > - firing the probe all the time and using a predicate to > generate traces or not, > - or compare the string inside an ''if'' statement into my code to > choose to fire the probe or not to generate traces? > > So does firing a probe and making a string comparaison inside a > predicate is a better choice than doing the string comparaison into an > ''if'' statement into my code to fire or not the probe? > > Thank''s > > -----Original Message----- > From: casper at holland.sun.com [mailto:casper at holland.sun.com]On Behalf Of > Casper.Dik at Sun.COM > Sent: vendredi 26 mai 2006 10:45 > To: Michael Schuster > Cc: Caruana, Damien; Jim.Fiori at Sun.COM; dtrace-discuss at opensolaris.org > Subject: Re: [dtrace-discuss] Does the use of predicates removes all > performance impact? > > > > >Caruana, Damien wrote: > >> If I well understood, > >> If I defined a probe into my source code, each time my Dtrace probe > will > >> by met in my code, some dtrace code will be executed in the kernel > even > >> if I don''t use any Dtrace script. > > > >no (according to my understanding). > > The probe code is converted to nops. Which basically means there''s > "next to no" impact but not exactly zero. > > >once you start tracing, the code at the point you''re watching is > >dynamically changed to - put very basically - branch to the > DTrace-specific > >code. This code then evaluates any predicates. > > Yes, but for probe points, some instruction space is reserved. > > Casper > _______________________________________________ > dtrace-discuss mailing list > dtrace-discuss at opensolaris.org