[DTrace-devel] [PATCH 1/2] examples: update the comments in script fcalls.d

Kris Van Hees kris.van.hees at oracle.com
Fri Aug 15 15:56:18 UTC 2025


Comment below...

On Thu, Aug 14, 2025 at 06:24:56PM -0400, Eugene Loh via DTrace-devel wrote:
> Reviewed-by: Eugene Loh <eugene.loh at oracle.com>
> 
> On 8/14/25 18:22, eugene.loh at oracle.com wrote:
> > From: Ruud van der Pas <ruud.vanderpas at oracle.com>
> > 
> > dtrace/ChangeLog
> > 2025-08-14  Ruud van der Pas  <ruud.vanderpas at oracle.com>
> > 
> > 	* examples/fcalls.d: Modified several comments.
> > 
> > Signed-off-by: Ruud van der Pas <ruud.vanderpas at oracle.com>
> > ---
> >   examples/fcalls.d | 14 +++++++++-----
> >   1 file changed, 9 insertions(+), 5 deletions(-)
> > 
> > diff --git a/examples/fcalls.d b/examples/fcalls.d
> > index 9e42f0041..c332dce40 100755
> > --- a/examples/fcalls.d
> > +++ b/examples/fcalls.d
> > @@ -8,7 +8,7 @@
> >    *    sudo ./fcalls.d -c "<name-of-application> [app options]"
> >    *
> >    *  DESCRIPTION
> > - *    This program lists the functions executed by the target
> > + *    This script lists the functions executed by the target
> >    *    application.  In addition to this, the number of calls to
> >    *    each function is printed.  This information is given on a
> >    *    per-thread basis, as well as aggregated over all threads.
> > @@ -19,12 +19,14 @@
> >    *    duplicate the probe definitions and in the copied lines
> >    *    replace a.out by libc.so.
> >    *    For example:
> > - *    pid$target:a.out::entry,pid$target:libc.so::entry
> > - *      { ... }
> > + *      pid$target:a.out::entry,
> > + *      pid$target:libc.so::entry
> > + *        { <clauses> }

This is a strange comment...  A clause in D is understood to be a { ... }
code block that is associated with one or more probe specifications.  So,
{ <clauses> } is not really conveying a correct syntax/terminology mix.

I think that the original { ... } was actually more clear.

> > + *
> >    *    - It is assumed that a function called main is executed.
> >    *    If this is not the case, this is not a critical error.
> >    *    The first probe is used to capture the name of the executable,
> > - *    but this is not critical.  The probe and printf statement
> > + *    but this is not essential.  The probe and printf statement
> >    *    can safely be removed, or replaced by a suitable alternative.
> >    */
> > @@ -45,9 +47,10 @@ pid$target:a.out:main:entry
> >   {
> >     executable_name = execname;
> >   }
> > +
> >   /*
> >    *  Use 4 aggregations to store the total number of function
> > - *  calls, the counts per function and per thread, both
> > + *  calls, the counts per function and per thread, both
> >    *  seperately and differentiated by thread and function.
> >    */
> >   pid$target:a.out::entry
> > @@ -57,6 +60,7 @@ pid$target:a.out::entry
> >     @call_counts_per_thr[tid]                   = count();
> >     @counts_per_thr_and_function[tid,probefunc] = count();
> >   }
> > +
> >   /*
> >    *  Print the results.  Use format strings to create a
> >    *  table lay-out.
> 
> _______________________________________________
> DTrace-devel mailing list
> DTrace-devel at oss.oracle.com
> https://oss.oracle.com/mailman/listinfo/dtrace-devel



More information about the DTrace-devel mailing list