Skip to content

Commit

Permalink
probe: ensure probe argument info is retrieved only once per probe
Browse files Browse the repository at this point in the history
Throughout the compilation process there are multiple points where
probe argument information is requested from the providers.  This
data cannot change during a runtime of DTrace and there is therefore
no reason to go through the process of retrieving it more than once.

The prp->argc (probe argument count) is used to determine if argument
data has been obtained.  It is initially -1, and will be 0 or greater
once argument data has been requested.

Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com>
Reviewed-by: Eugene Loh <eugene.loh@oracle.com>
  • Loading branch information
kvanhees committed Feb 16, 2023
1 parent ca761db commit 412c5f2
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion libdtrace/dt_probe.c
Original file line number Diff line number Diff line change
Expand Up @@ -695,6 +695,7 @@ dt_probe_insert(dtrace_hdl_t *dtp, dt_provider_t *prov, const char *prv,
prp->desc = desc;
prp->prov = prov;
prp->prv_data = datap;
prp->argc = -1;

dt_htab_insert(dtp->dt_byprv, prp);
dt_htab_insert(dtp->dt_bymod, prp);
Expand Down Expand Up @@ -865,13 +866,18 @@ dt_probe_args_info(dtrace_hdl_t *dtp, dt_probe_t *prp)
int i, nc, xc;
dtrace_typeinfo_t dtt;

/* Only retrieve probe argument information once per probe. */
if (prp->argc != -1)
return;
if (!prp->prov->impl->probe_info)
return;
if (prp->prov->impl->probe_info(dtp, prp, &argc, &argv) < 0)
return;

if (!argc || !argv)
if (!argc || !argv) {
prp->argc = 0;
return;
}

nc = 0;
for (xc = 0; xc < argc; xc++)
Expand Down

0 comments on commit 412c5f2

Please sign in to comment.